post_states_html
Filters the HTML string of post states.
Использование
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(строка)
- 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.
Список изменений
| С версии 6.9.0 | Введена. |
Где вызывается хук
post_states_html
wp-admin/includes/template.php 2279
$post_states_html = apply_filters( 'post_states_html', $post_states_html, $post_states, $post );