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 string[] $post_states An array of post display states. * @param WP_Post $post The current post object. * * @return string[] */ function wp_kama_display_post_states_filter( $post_states, $post ){ // filter... return $post_states; }
- $post_states(string[])
- An array of post display states.
- $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_states
wp-admin/includes/template.php 2338
return apply_filters( 'display_post_states', $post_states, $post );