wordpress删除wp-json和REST API

Saturday, Dec 29, 2018 | 1 minute read | Updated at Saturday, Dec 29, 2018

@

把以下代码添加到主题目录下的functions.php文件中

禁用REST API功能代码:

add_filter('rest_enabled', '__return_false'); add_filter('rest_jsonp_enabled', '__return_false');

移除wp-json链接的代码:

remove_action( 'wp_head', 'rest_output_link_wp_head', 10 ); remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );

© 2018 - 2026 vpslala

🌱 Powered by Hugo with theme Dream.