display_post_states
Filters the default post display states used in the posts list table.
Usage
add_filter( 'display_post_states', 'wp_kama_display_post_states_filter', 10, 2 ); /** * Function for `display_post_states` filter-hook. * * @param array$post_states A mapping of post state slugs to translated post state labels. E.g. `array( 'draft' => __( 'Draft' ), 'sticky' => __( 'Sticky' ), ... )`. * @param WP_Post $post The current post object. * * @return array
- $post_states(array<string,)
- string> $post_states A mapping of post state slugs to translated post state labels. E.g. array( 'draft' => __( 'Draft' ), 'sticky' => __( 'Sticky' ), ... ).
- $post(WP_Post)
- The current post object.
Changelog
Since 2.8.0 Introduced. Since 3.6.0 Added the $post parameter. Since 5.5.0 Also applied in the Customizer context. If any admin functions are used within the filter, their existence should be checked with function_exists() before being used. Where the hook is called
display_post_stateswp-admin/includes/template.php 2362return apply_filters( 'display_post_states', $post_states, $post );Where the hook is used in WordPress
Usage not found.