傻大憨

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 傻大憨

shadahan.com是一个关注跨境电商、创业话题的网站。

预算1000元左右 wordpress模板建站是明智选择

千元预算建站:为什么WordPress模板是你的唯一明智选择 对于中小企业主和创业者来说,”网站建… Continue reading 预算1000元左右 wordpress模板建站是明智选择

wordpress根据文章分类自动调用指定页面模板

通过wordpress分类目录的别名来调用指定的single模板

wordpress调用最新文章

wordpress按栏目调用最新文章

广东wordpress外贸建站须知

在广东进行WordPress外贸建站时,需要注意以下几个关键点: 选择合适的主题和插件:WordPress提供… Continue reading 广东wordpress外贸建站须知

WordPress外贸网站建设的最佳实践

  在当今数字化的商业环境中,WordPress成为了许多外贸企业建设网站的首选平台之一。本文将深入解读一些成… Continue reading WordPress外贸网站建设的最佳实践

跨境电商独立站建完后没客户怎么办

跨境电商独立站建完后如果没有客户,可以采取以下策略来解决。可以逐步提升独立站的流量和订单量,从而解决没有客户的困境。