@@ -2246,22 +2246,22 @@ function iframe_footer() {
22462246 * @return string Post states string.
22472247 */
22482248function _post_states ( $ post , $ display = true ) {
2249- $ post_states = get_post_states ( $ post );
2250- $ post_states_string = '' ;
2249+ $ post_states = get_post_states ( $ post );
2250+ $ post_states_html = '' ;
22512251
22522252 if ( ! empty ( $ post_states ) ) {
22532253 $ state_count = count ( $ post_states );
22542254
22552255 $ i = 0 ;
22562256
2257- $ post_states_string .= ' — ' ;
2257+ $ post_states_html .= ' — ' ;
22582258
22592259 foreach ( $ post_states as $ state ) {
22602260 ++$ i ;
22612261
22622262 $ separator = ( $ i < $ state_count ) ? ', ' : '' ;
22632263
2264- $ post_states_string .= "<span class='post-state'> {$ state }{$ separator }</span> " ;
2264+ $ post_states_html .= "<span class='post-state'> {$ state }{$ separator }</span> " ;
22652265 }
22662266 }
22672267
@@ -2270,17 +2270,19 @@ function _post_states( $post, $display = true ) {
22702270 *
22712271 * @since 6.9.0
22722272 *
2273- * @param string $post_states_string The post states HTML string.
2274- * @param string[] $post_states The post states.
2275- * @param WP_Post $post The current post object.
2273+ * @param string $post_states_html All relevant post sta60986tes combined into an HTML string for display.
2274+ * E.g. `— <span class='post-state'>Draft, </span><span class='post-state'>Sticky</span>`.
2275+ * @param string<string, string> $post_states A mapping of post state slugs to translated post state labels.
2276+ * E.g. `array( 'draft' => 'Draft', 'sticky' => 'Sticky' )`.
2277+ * @param WP_Post $post The current post object.
22762278 */
2277- $ post_states_string = apply_filters ( 'post_states_string ' , $ post_states_string , $ post_states , $ post );
2279+ $ post_states_html = apply_filters ( 'post_states_html ' , $ post_states_html , $ post_states , $ post );
22782280
22792281 if ( $ display ) {
2280- echo $ post_states_string ;
2282+ echo $ post_states_html ;
22812283 }
22822284
2283- return $ post_states_string ;
2285+ return $ post_states_html ;
22842286}
22852287
22862288/**
@@ -2353,8 +2355,8 @@ function get_post_states( $post ) {
23532355 * are used within the filter, their existence should be checked
23542356 * with `function_exists()` before being used.
23552357 *
2356- * @param string[] $post_states An array of post display states .
2357- * @param WP_Post $post The current post object.
2358+ * @param string<string, string> $post_states A mapping of post state slugs to translated post state labels .
2359+ * @param WP_Post $post The current post object.
23582360 */
23592361 return apply_filters ( 'display_post_states ' , $ post_states , $ post );
23602362}
0 commit comments