[Resolved] Hide all comments from all logged out users

Home Forums Support [Resolved] Hide all comments from all logged out users

Home Forums Support Hide all comments from all logged out users

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #237998
    Dominik

    Hi I would love to hide all comments (the comment functions completely) from all logged out users, such as shown here: http://wpsites.net/web-design/hide-comments-logged-out-users/

    Example Page: https://dotzauerinstitut.de/uebungen/klimmzuege/

    I’m a GP Premium customer – should/can I use hooks? What’s the best solution for this issue?

    Thank you!

    #238081
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    It’s possible, but takes a little coding.

    First, copy the comments.php file into your child theme.

    Then find this line:

    // No direct access, please
    if ( ! defined( 'ABSPATH' ) ) exit;

    And put this after it:

    if ( is_user_logged_in() ) :

    Then at the very end of the file, find this line:

    </div><!-- #comments -->

    And put this after it:

    <?php endif; ?>

    Hope this helps ๐Ÿ™‚

    #238300
    Dominik
    #238399
    Tom
    Lead Developer
    Lead Developer

    Awesome ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.