WordPress.org

Make WordPress Core

Opened 16 months ago

Last modified 16 months ago

#37462 new enhancement

Introduce is_private() conditional

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

Description

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

Attachments (2)

is_private.diff (820 bytes) - added by sillybean 16 months ago.
is_private.2.diff (819 bytes) - added by sillybean 16 months ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
16 months ago

  • Component changed from General to Posts, Post Types

#2 @johnbillion
16 months 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.