Support » Fixing WordPress » Heartbeat api not loading

  • Resolved bgentry

    (@bgentry)


    I am creating a theme that will use the heartbeat api on a few pages. I a plugin I was developing recently, I loaded the heartbeat api simply with:

    wp_enqueue_script(‘heartbeat’);

    And that would load heartbeat.min.js into the page. It seems that it also created the javascript variable for the heartbeat settings.

    However, in my new theme that uses the heartbeat api, enqueueing this script did nothing. I had to manually add the script into the page template, as well as have the template generate the heartbeat settings variable with a nonce. That is fine, and it works, but I wonder why the heartbeat api was not loading. Any answers?

Viewing 1 replies (of 1 total)
  • I was testing this on a theme that I was not finished making, and therefore had not added a call to wp_footer() which is where the heartbeat api loads. (I was also having trouble loading the media upload scripts for the same reason.) Once I added wp_footer(), the heartbeat api loaded perfectly.

Viewing 1 replies (of 1 total)
  • The topic ‘Heartbeat api not loading’ is closed to new replies.