Make WordPress Core

Opened 3 years ago

Last modified 6 weeks ago

#37462 new enhancement

Introduce is_private() conditional

Reported by: sillybean Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: needs-patch needs-unit-tests
Focuses: template Cc:


Add a quick conditional tag to check whether the post is private.

Attachments (2)

is_private.diff (820 bytes) - added by sillybean 3 years ago.
is_private.2.diff (819 bytes) - added by sillybean 3 years ago.

Download all attachments as: .zip

Change History (4)

3 years ago

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Posts, Post Types

#2 @johnbillion
3 years ago

  • Keywords needs-patch needs-unit-tests added
  • Version trunk deleted

Thanks for the patch, @sillybean. Some feedback for you:

  • This probably needs a more descriptive function name, such as is_private_post().
  • Have you tested this function? It's checking the value of the post_password field.
  • This will need unit tests to avoid the above.
Note: See TracTickets for help on using tickets.