Changeset 9952
- Timestamp:
- 06/03/2020 02:44:14 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php
r9722 r9952 40 40 add_action( 'bbp_template_redirect', array( $this, 'redirect_attachments' ) ); 41 41 42 // REST API.43 add_filter( 'rest_endpoints', array( $this, 'disable_rest_api_users_endpoint' ) );44 45 42 // Disable post meta key lookup, see https://core.trac.wordpress.org/ticket/33885. 46 43 add_filter( 'postmeta_form_keys', '__return_empty_array' ); … … 68 65 remove_filter( 'template_redirect', 'redirect_canonical' ); 69 66 } 70 }71 72 /**73 * Disables REST API endpoint for users listing.74 *75 * @link https://core.trac.wordpress.org/ticket/3887876 *77 * @param array $endpoints The available endpoints.78 * @return array The filtered endpoints.79 */80 public function disable_rest_api_users_endpoint( $endpoints ) {81 if ( ! isset( $endpoints['/wp/v2/users'] ) ) {82 return $endpoints;83 }84 85 foreach ( $endpoints['/wp/v2/users'] as &$handler ) {86 if ( isset( $handler['methods'] ) && 'GET' === $handler['methods'] ) {87 $handler['permission_callback'] = function() {88 return new WP_Error(89 'rest_not_implemented',90 __( 'Sorry, you are not allowed to list users.' ),91 array( 'status' => 501 )92 );93 };94 95 break;96 }97 }98 99 return $endpoints;100 67 } 101 68
Note: See TracChangeset
for help on using the changeset viewer.