• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

How To Hide Comments From Logged Out Users

If for some reason you want to hide all your comments and the comments form from logged out users, you can.

Simply add this code to the end of your child themes functions.php file and it will stop the comments template from loading.

You could change the hooks if using a theme other than Genesis.

Another option would be to hide the comments but keep the comments form visible for logged out users.

You could even echo some text and HTML with a link to the login or registration page to your site.

Another option is to only display a login to comment link and NOT display a logout link which is already included above the comment form anyway.

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems