- Timestamp:
- 06/21/2022 10:46:49 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
r52610 r53544 334 334 $response->add_links( $this->prepare_links( $theme ) ); 335 335 336 if ( $theme->get_stylesheet() === wp_get_theme()->get_stylesheet() ) {337 // This creates a record for the active theme if not existent.338 $id = WP_Theme_JSON_Resolver::get_user_global_styles_post_id();339 } else {340 $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );341 $id = isset( $user_cpt['ID'] ) ? $user_cpt['ID'] : null;342 }343 344 if ( $id ) {345 $response->add_link(346 'https://api.w.org/user-global-styles',347 rest_url( 'wp/v2/global-styles/' . $id )348 );349 }350 351 336 /** 352 337 * Filters theme data returned from the REST API. … … 370 355 */ 371 356 protected function prepare_links( $theme ) { 372 returnarray(357 $links = array( 373 358 'self' => array( 374 359 'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $theme->get_stylesheet() ) ), … … 378 363 ), 379 364 ); 365 366 if ( $this->is_same_theme( $theme, wp_get_theme() ) ) { 367 // This creates a record for the active theme if not existent. 368 $id = WP_Theme_JSON_Resolver::get_user_global_styles_post_id(); 369 } else { 370 $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme ); 371 $id = isset( $user_cpt['ID'] ) ? $user_cpt['ID'] : null; 372 } 373 374 if ( $id ) { 375 $links['https://api.w.org/user-global-styles'] = array( 376 'href' => rest_url( 'wp/v2/global-styles/' . $id ), 377 ); 378 } 379 380 return $links; 380 381 } 381 382
Note: See TracChangeset
for help on using the changeset viewer.