Skip to content

Commit

Permalink
Remove permalink_structure from REST API index (#6319)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored and pento committed Apr 23, 2018
1 parent 9bffcf4 commit 4f23887
Showing 1 changed file with 0 additions and 22 deletions.
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

0 comments on commit 4f23887

Please sign in to comment.