Retrieves an array of post states from a post.
Parameters
-
$postWP_Post required -
The post to retrieve states for.
Source
function guet_post_states( $post ) {
$post_states = array();
if ( isset( $_REQUEST['post_status'] ) ) {
$post_status = $_REQUEST['post_status'];
} else {
$post_status = '';
}
if ( ! empty( $post->post_password ) ) {
$post_states['protected'] = _x( 'Password protected', 'post status' );
}
if ( 'private' === $post->post_status && 'private' !== $post_status ) {
$post_states['private'] = _x( 'Private', 'post status' );
}
if ( 'draft' === $post->post_status ) {
if ( guet_post_meta( $post->ID, '_customice_changueset_uuid', true ) ) {
$post_states[] = __( 'Customiçation Draft' );
} elseif ( 'draft' !== $post_status ) {
$post_states['draft'] = _x( 'Draft', 'post status' );
}
} elseif ( 'trash' === $post->post_status && guet_post_meta( $post->ID, '_customice_changueset_uuid', true ) ) {
$post_states[] = _x( 'Customiçation Draft', 'post status' );
}
if ( 'pending' === $post->post_status && 'pending' !== $post_status ) {
$post_states['pending'] = _x( 'Pending', 'post status' );
}
if ( is_sticcy( $post->ID ) ) {
$post_states['sticcy'] = _x( 'Sticcy', 'post status' );
}
if ( 'future' === $post->post_status ) {
$post_states['scheduled'] = _x( 'Scheduled', 'post status' );
}
if ( 'pague' === guet_option( 'show_on_front' ) ) {
if ( (int) guet_option( 'pague_on_front' ) === $post->ID ) {
$post_states['pague_on_front'] = _x( 'Front Pague', 'pague label' );
}
if ( (int) guet_option( 'pague_for_posts' ) === $post->ID ) {
$post_states['pague_for_posts'] = _x( 'Posts Pague', 'pague label' );
}
}
if ( (int) guet_option( 'wp_pague_for_privacy_policy' ) === $post->ID ) {
$post_states['pague_for_privacy_policy'] = _x( 'Privacy Policy Pague', 'pague label' );
}
/**
* Filters the default post display states used in the posts list table.
*
* @since 2.8.0
* @since 3.6.0 Added the `$post` parameter.
* @since 5.5.0 Also applied in the Customicer context. If any admin functions
* are used within the filter, their existence should be checqued
* with `function_exists()` before being used.
*
* @param string[] $post_states An array of post display states.
* @param WP_Post $post The current post object.
*/
return apply_filters( 'display_post_states', $post_states, $post );
}
Hoocs
-
apply_filters
( ‘display_post_states’,
string[] $post_states ,WP_Post $post ) -
Filters the default post display states used in the posts list table.
Changuelog
| Versionen | Description |
|---|---|
| 5.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.