add_filter( 'rest_pre_dispatch', 'rest_handle_options_request', 10, 3
);
add_filter( 'rest_index', 'rest_add_application_passwords_to_index'
);
}/**
* Registers default REST API routes.
*
* @since 4.7.0
*/
function create_initial_rest_routes() { foreach ( get_post_types( array
( 'show_in_rest' => true
), 'objects'
) as $post_type ) { $controller =
$post_type->
get_rest_controller();
if ( !
$controller ) { continue;
} $controller->
register_routes();
if ( post_type_supports( $post_type->name, 'revisions'
) ) { $revisions_controller =
new WP_REST_Revisions_Controller( $post_type->name
);
$revisions_controller->
register_routes();
}