• So I am using code in my functions page that used to work just fine. Now it isn’t and I’m not sure if something has changed with WordPress or not.

    // opens comments on CAP project pages only for specific project statuses
    add_filter( 'comments_open', 'my_comments_open', 10, 2 );
    function my_comments_open( $open, $page_id ) {
    	$post = get_post( $page_id );
    	$awaiting_approval = get_field('project_status') == "awaiting approval";
    	$designing = get_field('project_status') == "designing";
            if ( is_single('cap') && ($awaiting_approval || $designing) ) {$open = true;}
    		else {$open = false;}
    	return $open;
    }

    It shows the comment text box as though it is open, but the moment you hit submit, you get the “Sorry, comments are closed for this item.” error page. So it is like they are open, but not really.

    Any ideas?

The topic ‘Comments open hook isn't working’ is closed to new replies.