How to create a single page comment template with a custom post type in WordPress

I created my own post type called blogs and added a post to this post type. But I cannot see the comment template in one page of this custom post type.

I also used comments_template( '', true );

But it doesn't show anything.

+3


source to share


2 answers


Notify this SQL query in your database

UPDATE wp_posts SET comment_status = 'open' WHERE post_type = 'blog';

      



and don't forget to check the box in settings -> Discussion settings -> Allow users to leave comments on new articles

in the admin panel and click "Save Changes".

+3


source


you can also use the following queries as per your need



UPDATE wp_posts SET comment_status='open' WHERE post_status = 'publish' AND post_type = 'blog';
UPDATE wp_posts SET comment_status='open' WHERE post_status = 'publish' AND post_type = 'blog';
UPDATE wp_posts SET ping_status='open' WHERE post_status = 'publish' AND post_type = 'blog';
UPDATE wp_posts SET ping_status='open' WHERE post_status = 'publish' AND post_type = 'blog';

      

+4


source







All Articles