Why is the Ajax heartbeat included in my cached frontend pages? Is it OK to get rid of it?

I recently thought I’d protect a WP site’s /wp-admin folder with Apache’s basic auth to provide a crude but somewhat effective additional layer of security (as a second line of defense should the WP install accidentally go out of date or an exploit emerge). However when I did this, I immediately noticed that the site’s … Read more

CPU usage: AJAX and Heartbeat API on admin pages

My (shared) web host recently sent me this: “Our server monitoring systems keep indicating high server load persistently maintained by your website (…). Most of the hits are to the /www/www/wp-admin/admin-ajax.php script. We would advise the following: Do not stay logged into the WordPress dashboard through the day. Once you finish your work, you should … Read more

How to create notification on frontend using heartbeat api for multiple custom post types

How can I get correct action hook on publish_posts for multiple custom types ? I have a following problem, I can use this hook for posts or single custom post_type, but I don’t know correct hook for multiple custom post types: // Post publication for posts add_filter ( ‘publish_post’, ‘notify_published_post’ ); function notify_published_post( $post_id ) … Read more

How to link WordPress heartbeat to ajax form

I have a form that $_POSTs an input value, and user’s ID that saves the data to the database: // frontend form <form id=”form”> <input type=”radio” name=”location” id=”name1″ value=”1″> <label for=”name1″>Label 1</label> <input type=”radio” name=”location” id=”name2″ value=”2″> <label for=”name2″>Label 2</label> <input type=”radio” name=”location” id=”name3″ value=”3″> <label for=”name3″>Label 3</label> <input type=”hidden” name=”userid” value=”{userid}”> </form> // footer … Read more

Log of Heartbeat Calls

I’ve read that Heartbeat can slow a WP site down and I’m assuming if our admins/store managers have a lot of admin windows/tabs open, this will exacerbate the issue. If yes, is there a condition to test and log the calls that Heartbeat makes so I can see if the site slowdown could be related … Read more

Heartbeat API oEmbed

By default running content through the_content filter automatically checks for oEmbed content. However when returning data through heartbeat_received the filter for oEmbed doesn’t seem to work. For example – function test_heartbeat_received( $response, $data ) { if( $data[‘test_heartbeat’] == ‘test’ ) { $content = “https://twitter.com/WordPress/status/456502643738030080”; // Doesn’t work global $wp_embed; $content = $wp_embed->autoembed( $content ); $response[‘test_heartbeat’] … Read more