Changeset 52372 for trunk/src/wp-includes/class-wp-theme-json-resolver.php
- Timestamp:
- 12/14/2021 04:12:57 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json-resolver.php
r52323 r52372 226 226 * @param WP_Theme $theme The theme object. If empty, it 227 227 * defaults to the current theme. 228 * @param bool $ should_create_cptOptional. Whether a new custom post228 * @param bool $create_post Optional. Whether a new custom post 229 229 * type should be created if none are 230 230 * found. Default false. … … 234 234 * @return array Custom Post Type for the user's origin config. 235 235 */ 236 public static function get_user_data_from_ custom_post_type( $theme, $should_create_cpt = false, $post_status_filter = array( 'publish' ) ) {236 public static function get_user_data_from_wp_global_styles( $theme, $create_post = false, $post_status_filter = array( 'publish' ) ) { 237 237 if ( ! $theme instanceof WP_Theme ) { 238 238 $theme = wp_get_theme(); … … 263 263 264 264 // Special case: '-1' is a results not found. 265 if ( -1 === $post_id && ! $ should_create_cpt ) {265 if ( -1 === $post_id && ! $create_post ) { 266 266 return $user_cpt; 267 267 } … … 270 270 if ( is_array( $recent_posts ) && ( count( $recent_posts ) === 1 ) ) { 271 271 $user_cpt = $recent_posts[0]; 272 } elseif ( $ should_create_cpt ) {272 } elseif ( $create_post ) { 273 273 $cpt_post_id = wp_insert_post( 274 274 array( … … 297 297 * @since 5.9.0 298 298 * 299 * @return WP_Theme_JSON Entity that holds user data.299 * @return WP_Theme_JSON Entity that holds styles for user data. 300 300 */ 301 301 public static function get_user_data() { … … 305 305 306 306 $config = array(); 307 $user_cpt = self::get_user_data_from_ custom_post_type( wp_get_theme() );307 $user_cpt = self::get_user_data_from_wp_global_styles( wp_get_theme() ); 308 308 309 309 if ( array_key_exists( 'post_content', $user_cpt ) ) { … … 382 382 * @return integer|null 383 383 */ 384 public static function get_user_ custom_post_type_id() {384 public static function get_user_global_styles_post_id() { 385 385 if ( null !== self::$user_custom_post_type_id ) { 386 386 return self::$user_custom_post_type_id; 387 387 } 388 388 389 $user_cpt = self::get_user_data_from_ custom_post_type( wp_get_theme(), true );389 $user_cpt = self::get_user_data_from_wp_global_styles( wp_get_theme(), true ); 390 390 391 391 if ( array_key_exists( 'ID', $user_cpt ) ) {
Note: See TracChangeset
for help on using the changeset viewer.