Support » Fixing WordPress » Access status of comments in header.php

  • On my functions.php I have to disable a feature of a plugin for comments.
    I tried:

    if (!have_comments()) {
    	wp_deregister_script('foo-feature');
    }

    but have_comments() doesn’t have any effect: the script is globally deregistered.

    What can I do to access the comments status via functions.php? Or how can I deregister a script only if a page or post hasn’t comments?

  • The topic ‘Access status of comments in header.php’ is closed to new replies.