post_states_html
Filters the HTML string of post states.
Usage
add_filter( 'post_states_html', 'wp_kama_post_states_html_filter', 10, 3 ); /** * Function for `post_states_html` filter-hook. * * @param string $post_states_html All relevant post states combined into an HTML string for display. E.g. `— <span class='post-state'>Draft, </span><span class='post-state'>Sticky</span>`. * @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 string */ function wp_kama_post_states_html_filter( $post_states_html, $post_states, $post ){ // filter... return $post_states_html; }
- $post_states_html(string)
- All relevant post states combined into an HTML string for display. E.g.
— <span class='post-state'>Draft, </span><span class='post-state'>Sticky</span>. - $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 6.9.0 | Introduced. |
Where the hook is called
post_states_html
wp-admin/includes/template.php 2286
$post_states_html = apply_filters( 'post_states_html', $post_states_html, $post_states, $post );