I use a custom page template review-template for my custom post type reviews. And on my template, I use a custom comment form review-comments.

Now... How do I enable login only for my review-comments but not for my posts and other custom post types comments?


First, you will need to go into the comments template file and use get_post_type() to check if the post type is reviews.

Then check if the user is logged in using is_user_logged_in().

If they are not logged in display message: "You must be logged in to post a comment."

If they are logged in, display the comment form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.