Changeset 60993 for trunk/src/wp-admin/includes/template.php
- Timestamp:
- 10/20/2025 09:43:10 PM (11 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/template.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template.php
r60986 r60993 2247 2247 */ 2248 2248 function _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 = ''; 2251 2251 2252 2252 if ( ! empty( $post_states ) ) { … … 2255 2255 $i = 0; 2256 2256 2257 $post_states_ string.= ' — ';2257 $post_states_html .= ' — '; 2258 2258 2259 2259 foreach ( $post_states as $state ) { … … 2262 2262 $separator = ( $i < $state_count ) ? ', ' : ''; 2263 2263 2264 $post_states_ string.= "<span class='post-state'>{$state}{$separator}</span>";2264 $post_states_html .= "<span class='post-state'>{$state}{$separator}</span>"; 2265 2265 } 2266 2266 } … … 2271 2271 * @since 6.9.0 2272 2272 * 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 states 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. 2276 2278 */ 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 ); 2278 2280 2279 2281 if ( $display ) { 2280 echo $post_states_ string;2281 } 2282 2283 return $post_states_ string;2282 echo $post_states_html; 2283 } 2284 2285 return $post_states_html; 2284 2286 } 2285 2287 … … 2354 2356 * with `function_exists()` before being used. 2355 2357 * 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 * E.g. `array( 'draft' => __( 'Draft' ), 'sticky' => __( 'Sticky' ), ... )`. 2360 * @param WP_Post $post The current post object. 2358 2361 */ 2359 2362 return apply_filters( 'display_post_states', $post_states, $post );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)