Changeset 48620 for trunk/src/wp-admin/includes/template.php
- Timestamp:
- 07/26/2020 10:49:07 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template.php
r48619 r48620 2150 2150 2151 2151 /** 2152 * Retrieves an array of post states from a post. 2153 * 2154 * @since 5.3.0 2155 * 2156 * @param WP_Post $post The post to retrieve states for. 2157 * @return string[] Array of post state labels keyed by their state. 2158 */ 2159 function get_post_states( $post ) { 2160 $post_states = array(); 2161 2162 if ( isset( $_REQUEST['post_status'] ) ) { 2163 $post_status = $_REQUEST['post_status']; 2164 } else { 2165 $post_status = ''; 2166 } 2167 2168 if ( ! empty( $post->post_password ) ) { 2169 $post_states['protected'] = _x( 'Password protected', 'post status' ); 2170 } 2171 2172 if ( 'private' === $post->post_status && 'private' !== $post_status ) { 2173 $post_states['private'] = _x( 'Private', 'post status' ); 2174 } 2175 2176 if ( 'draft' === $post->post_status ) { 2177 if ( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) { 2178 $post_states[] = __( 'Customization Draft' ); 2179 } elseif ( 'draft' !== $post_status ) { 2180 $post_states['draft'] = _x( 'Draft', 'post status' ); 2181 } 2182 } elseif ( 'trash' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) { 2183 $post_states[] = _x( 'Customization Draft', 'post status' ); 2184 } 2185 2186 if ( 'pending' === $post->post_status && 'pending' !== $post_status ) { 2187 $post_states['pending'] = _x( 'Pending', 'post status' ); 2188 } 2189 2190 if ( is_sticky( $post->ID ) ) { 2191 $post_states['sticky'] = _x( 'Sticky', 'post status' ); 2192 } 2193 2194 if ( 'future' === $post->post_status ) { 2195 $post_states['scheduled'] = _x( 'Scheduled', 'post status' ); 2196 } 2197 2198 if ( 'page' === get_option( 'show_on_front' ) ) { 2199 if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) { 2200 $post_states['page_on_front'] = _x( 'Front Page', 'page label' ); 2201 } 2202 2203 if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) { 2204 $post_states['page_for_posts'] = _x( 'Posts Page', 'page label' ); 2205 } 2206 } 2207 2208 if ( intval( get_option( 'wp_page_for_privacy_policy' ) ) === $post->ID ) { 2209 $post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' ); 2210 } 2211 2212 /** 2213 * Filters the default post display states used in the posts list table. 2214 * 2215 * @since 2.8.0 2216 * @since 3.6.0 Added the `$post` parameter. 2217 * 2218 * @param string[] $post_states An array of post display states. 2219 * @param WP_Post $post The current post object. 2220 */ 2221 return apply_filters( 'display_post_states', $post_states, $post ); 2222 } 2223 2224 /** 2152 2225 * Outputs the attachment media states as HTML. 2153 2226 *
Note: See TracChangeset
for help on using the changeset viewer.