Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove permalink_structure from REST API index #6319

Merged
merged 1 commit into from
Apr 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions lib/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,28 +216,6 @@ function gutenberg_add_rest_nonce_to_heartbeat_response_headers( $response ) {

add_filter( 'wp_refresh_nonces', 'gutenberg_add_rest_nonce_to_heartbeat_response_headers' );

/**
* Ensure that the wp-json index contains the `permalink_structure` setting as
* part of its site info elements.
*
* @see https://core.trac.wordpress.org/ticket/42465
*
* @param WP_REST_Response $response WP REST API response of the wp-json index.
* @return WP_REST_Response Response that contains the permalink structure.
*/
function gutenberg_ensure_wp_json_has_permalink_structure( $response ) {
$site_info = $response->get_data();

if ( ! array_key_exists( 'permalink_structure', $site_info ) ) {
$site_info['permalink_structure'] = get_option( 'permalink_structure' );
}

$response->set_data( $site_info );

return $response;
}
add_filter( 'rest_index', 'gutenberg_ensure_wp_json_has_permalink_structure' );

/**
* As a substitute for the default content `wpautop` filter, applies autop
* behavior only for posts where content does not contain blocks.
Expand Down