SOHO建站

wordpress禁用Rest API

将以下代码插入到functions.php文件中即可

add_filter("json_enabled", "__return_false");
add_filter("json_jsonp_enabled", "__return_false");
add_filter("rest_enabled", "__return_false");
add_filter("rest_jsonp_enabled", "__return_false");
remove_action("init", "rest_api_init");
remove_action("rest_api_init", "rest_api_default_filters", 10);
remove_action("parse_request", "rest_api_loaded");
remove_action("wp_head", "rest_output_link_wp_head", 10);
remove_action("template_redirect", "rest_output_link_header", 11);
remove_action("auth_cookie_malformed", "rest_cookie_collect_status");
remove_action("auth_cookie_expired", "rest_cookie_collect_status");
remove_action("auth_cookie_bad_username", "rest_cookie_collect_status");
remove_action("auth_cookie_bad_hash", "rest_cookie_collect_status");
remove_action("auth_cookie_valid", "rest_cookie_collect_status");
 
add_filter("rest_authentication_errors", function () {
    return new WP_Error("rest_disabled", __("The REST API on this site has been disabled."), ["status" => rest_authorization_required_code()]);
});
Published
Categorized as 建站知识 Tagged

By SOHO

wowsoho.com是一个wordpress建站公司

实现wordpress一篇文章只允许同一IP评论一次

让一个IP只能评论一次

用wordpress搭建网站选择模板指南

在用WordPress搭建网站选择模板时,应明确网站目标和风格、考虑性能与安全性、评估功能与扩展性、考虑可定制性与文档支持、关注主机环境和兼容性等。

WordPress调用指定分类文章

按指定分类调用wordpress文章

wordpress 禁止后台编辑主题

禁止后台编辑主题和插件文件,只需要在wp-config.php中添加以下代码即可。

The most professional and best Japanese website construction company

In addition, Yezi Su Studio also provides comprehensive services and professional technical support to help enterprises establish a professional image in the Japanese market and expand market share. Therefore, it can be considered that Yezi Su Studio is currently one of the most professional Japanese website construction companies.

wordpress子分类使用父分类模板

wordpress子分类继承使用父分类模板