Making WordPress.org

Changeset 12782


Ignore:
Timestamp:
08/01/2023 10:33:50 PM (2 years ago)
Author:
coffee2code
Message:

Photo Directory, Flagged: Add is_post_flagged() to determine if a given post is flagged.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/flagged.php

    r12725 r12782  
    116116            self::get_post_status()
    117117        ) );
     118    }
     119
     120    /**
     121     * Is a given post flagged?
     122     *
     123     * @param int|WP_Post $post The post or post ID.
     124     * @return bool True if post is flagged, else false.
     125     */
     126    public static function is_post_flagged( $post ) {
     127        $post = get_post( $post );
     128        if ( $post && self::get_post_status() === get_post_status( $post ) ) {
     129            return true;
     130        }
     131
     132        return false;
    118133    }
    119134
Note: See TracChangeset for help on using the changeset viewer.