Opened 7 years ago
Last modified 4 years ago
#37462 new enhancement
Introduce is_private() conditional
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | template | Cc: |
Description
Add a quick conditional tag to check whether the post is private.
Attachments (4)
Change History (7)
#3
@
4 years ago
- Keywords has-patch added; needs-patch needs-unit-tests removed
My attached patch, 37462.diff, introduced a new function - is_private_post( $post )
- which returns true
if the $post
passed is private
and false
if otherwise. It uses the function get_post_status()
.
Reference:
https://developer.wordpress.org/reference/functions/get_post_status/
Note: See
TracTickets for help on using
tickets.
Thanks for the patch, @sillybean. Some feedback for you:
is_private_post()
.post_password
field.