WordPress.org

Ready to get started?Download WordPress

Forums

Access status of comments in header.php (1 post)

  1. aldolat
    Member
    Posted 4 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic