Forums

protected post (7 posts)

  1. sefran
    Member
    Posted 2 years ago #

    Hi.
    Is there a function call (or anything else way) to verify that a post is protected?
    Thanks in advance.

  2. mrmist
    Forum Janitor
    Posted 2 years ago #

    Do you want a way of checking in php code, or just to confirm it?

  3. sefran
    Member
    Posted 2 years ago #

    I want to check it in php code so that I can do something if the post is protected or not.

  4. mrmist
    Forum Janitor
    Posted 2 years ago #

    In a WordPress plugin or similar you could use post_password_required(postid)

    Outside of that, if you google for post_password_required you can find the code behind it (which is in wp-includes/post-template.php) and go from there.

  5. sefran
    Member
    Posted 2 years ago #

    Thank you very much. The post_password_required(postid) is perfect.
    Ciao,
    Fran

  6. sefran
    Member
    Posted 2 years ago #

    From which WP version post_password_required(postid) works?
    From 2.7.1. Confirm?
    I have an "undefined function post_password_required()" message when I try my plugin with WP 2.7, while it works with WP 2.7.1.

  7. sefran
    Member
    Posted 2 years ago #

    Sorry... it works well also with WP 2.7 version, I was trying with an older version.
    The post_password_required() is defined from WP 2.7 version.

Topic Closed

This topic has been closed to new replies.

About this Topic