• Resolved gambit37

    (@gambit37)


    I’m using “the_meta()” in my theme file to display all the associated custom data for a post as a list.

    Works fine, except that on password protected posts, the meta data is displayed and then the password protect form is displayed.

    I only want the meta data (custom fields values) displayed once the user has entered their password to view the post, but I couldn’t find anything in the docs for this. I know I can check if a post has a apssword, but that doesn’t help in this case — I need to know if the user actually used the password to view the post, and if so, only then display the meta data.

    Any ideas on how I achieve this? Many thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter gambit37

    (@gambit37)

    I fixed it using the following conditional, to check if the password cookie is set and matches the password assigned to the post:

    <?php
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] == $post->post_password) {
    	the_meta();
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Using “the_meta” with password protected posts’ is closed to new replies.