Make WordPress Core

Changeset 60984

Timestamp:
10/20/2025 12:28:52 PM (5 weeks ago)
Author:
Mamaduka
Message:

REST API: Add export rel link for active theme response.

The targetHints.allow value is used by the Site Editor to enable/disable the theme export feature.

Props mamaduka, wildworks.
Fixes #57379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php

    r59965 r60984  
    415415        }
    416416
     417        if ( $theme->is_block_theme() && $this->is_same_theme( $theme, wp_get_theme() ) ) {
     418            $links['https://api.w.org/export-theme'] = array(
     419                'href'        => rest_url( 'wp-block-editor/v1/export' ),
     420                'targetHints' => array(
     421                    'allow' => current_user_can( 'export' ) ? array( 'GET' ) : array(),
     422                ),
     423            );
     424        }
     425
    417426        return $links;
    418427    }
Note: See TracChangeset for help on using the changeset viewer.