Make WordPress Core

Ticket #37462: is_private.2.diff

File is_private.2.diff, 819 bytes (added by sillybean, 8 years ago)
  • wp-includes/post-template.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    795795        return ! $hasher->CheckPassword( $post->post_password, $hash );
    796796}
    797797
     798/**
     799 * Whether post status is private.
     800 *
     801 * @since
     802 *
     803 * @param int|WP_Post|null $post An optional post. Global $post used if not provided.
     804 * @return bool true if the post status is 'private', false otherwise.
     805 */
     806function is_private( $post = null ) {
     807        $post = get_post( $post );
     808
     809        if ( ( 'private' == $post->post_password ) )
     810                return true;
     811
     812        return false;
     813}
     814
    798815//
    799816// Page Template Functions for usage in Themes
    800817//