• I’m using a theme which uses meta boxes for its settings page. I’m getting a warning at this settings page.

    Warning: Missing argument 2 for Comment_control::set_default_comment_status() in .../wp-content/plugins/comment-control/comment-control.php on line 62

    I’ve fixed it making the second argument optional.

    function set_default_comment_status( $post_type, $post = null ){
    		$screen = get_current_screen();
    		// only mess with new posts that support comments
    		if( ! $post || ! isset( $this->options['allow_comments_on'][$post_type] ) || $screen->action != 'add' || $screen->base != 'post' || ! post_type_supports( $post_type, 'comments' ) )
    			return;
    
    		$post->comment_status = $this->options['allow_comments_on'][$screen->id] ? 'open' : 'closed';
    		$post->ping_status = $this->options['allow_pings_on'][$screen->id] ? 'open' : 'closed';
    	}

    Greats from Germany
    LeisureLarry

    https://wordpress.org/plugins/comment-control/

Viewing 1 replies (of 1 total)
  • Plugin Author Samir Shah

    (@solarissmoke)

    Hi @leisurelarry,

    Thanks for this report. I’m just looking at the action that this function is hooked to however and it always supplies a $post argument. See the documentation and the code in core. So there should never arise a situation where the argument is missing.

    Is it possible that your theme is manually triggering that action and not passing a $post argument? If so I think that needs to be fixed in the theme as it is not consistent with how WordPress defines the action.

Viewing 1 replies (of 1 total)
  • The topic ‘Warning: Missing argument 2’ is closed to new replies.