wpseek.com
A WordPress-centric search engine for devs and theme authors
rest_api_register_rewrites › WordPress Function
Since4.4.0
Deprecatedn/a
› rest_api_register_rewrites ( No parameters )
See: | |
Defined at: |
|
Codex: |
Adds REST rewrite rules.
Related Functions: wp_register_script, rest_api_init, _wp_register_meta_args_whitelist, register_rest_route, wp_deregister_script
Source
function rest_api_register_rewrites() { global $wp_rewrite; add_rewrite_rule( '^' . rest_get_url_prefix() . '/?$', 'index.php?rest_route=/', 'top' ); add_rewrite_rule( '^' . rest_get_url_prefix() . '/(.*)?', 'index.php?rest_route=/$matches[1]', 'top' ); add_rewrite_rule( '^' . $wp_rewrite->index . '/' . rest_get_url_prefix() . '/?$', 'index.php?rest_route=/', 'top' ); add_rewrite_rule( '^' . $wp_rewrite->index . '/' . rest_get_url_prefix() . '/(.*)?', 'index.php?rest_route=/$matches[1]', 'top' ); }