• Resolved jkin

    (@jkin)


    I am excited to learn your wonderful snippet.
    Thanks a lot.

    Yet, I need help to add following code:

    add_action( 'init', 'stop_heartbeat', 1 );
    function stop_heartbeat() {
    wp_deregister_script('heartbeat');

    ————-
    The result comes out like this:

    The code snippet you are trying to save produced a fatal error on line 5:

    syntax error, unexpected end of file.
    Please advise how to fix this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    You’re missing a closing }. So your snippet should look like this in order to work:

    add_action( 'init', 'jkin_stop_heartbeat', 1 );
    function jkin_stop_heartbeat() {
    	wp_deregister_script('heartbeat');
    }

    I’ve also renamed the stop_heartbeat function to something a little more unique, so that there are no name collision errors. However, it’s even better to use something like this instead:

    add_action( 'init', function () {
    	wp_deregister_script('heartbeat');
    }, 1 );
    Thread Starter jkin

    (@jkin)

    WOW!!!

    Thanks sooo much..

    It works!!

    Plugin Author Shea Bunge

    (@bungeshea)

    No problem, glad to hear it’s working 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘stop heartbeat code’ is closed to new replies.