display_post_states
Filter HookDescription
Filters the default post display states used in the posts list table. are used within the filter, their existence should be checked with `function_exists()` before being used.Hook Information
File Location |
wp-admin/includes/template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2350 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$post_states
|
An array of post display states. |
WP_Post
|
$post
|
The current post object. |
Usage Examples
Basic Usage
<?php
// Hook into display_post_states
add_filter('display_post_states', 'my_custom_filter', 10, 2);
function my_custom_filter($post_states, $post) {
// Your custom filtering logic here
return $post_states;
}
Source Code Context
wp-admin/includes/template.php:2350
- How this hook is used in WordPress core
<?php
2345 * with `function_exists()` before being used.
2346 *
2347 * @param string[] $post_states An array of post display states.
2348 * @param WP_Post $post The current post object.
2349 */
2350 return apply_filters( 'display_post_states', $post_states, $post );
2351 }
2352
2353 /**
2354 * Outputs the attachment media states as HTML.
2355 *
PHP Documentation
<?php
/**
* 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 Customizer context. If any admin functions
* are used within the filter, their existence should be checked
* with `function_exists()` before being used.
*
* @param string[] $post_states An array of post display states.
* @param WP_Post $post The current post object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-admin/includes/template.php
Related Hooks
Related hooks will be displayed here in future updates.