How do I enable comments on pages?
-
Hello,
I know that wordpress recently turned off comments on pages by default.
I used the following snippet and created a MU plugin. but it does not work and break my site.
/** * Filter whether comments are open for a given post type. * * @param string $status Default status for the given post type, * either 'open' or 'closed'. * @param string $post_type Post type. Default is <code>post</code>. * @param string $comment_type Type of comment. Default is <code>comment</code>. * @return string (Maybe) filtered default status for the given post type. */ function wpdocs_open_comments_for_myposttype( $status, $post_type, $comment_type ) { if ( 'myposttype' !== $post_type ) { return $status; } // You could be more specific here for different comment types if desired return 'open'; } add_filter( 'get_default_comment_status', 'wpdocs_open_comments_for_myposttype', 10, 3 );
how do I do it?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How do I enable comments on pages?’ is closed to new replies.