傻大憨

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是一个关注跨境电商、创业话题的网站。

外贸老板用wordpress搭建独立站 需要懂哪些技术

越来越多的外贸老板,自己买wordpress模板,自己搭建外贸独立站。作为外贸老板,想要使用WordPress自己搭建独立站,需要了解一些基本的网站技术和概念。

俄语网站建设与推广服务的专业公司

巴耶赫利(bayeheli.com)是一家专注于俄语网站建设与推广服务的专业公司,致力于帮助中国品牌出海俄罗斯,提升品牌在俄罗斯市场的知名度和美誉度。

wordpress中文官网地址

wordpress中文官网地址是什么

wordpress子分类使用父分类模板

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

海外华人爱用简站wordpress主题搭建网站的10大原因

简站WordPress主题因其语言支持、本地化服务、简洁易用、SEO优化、响应式设计、定制性、成本效益、社区和支持、安全性以及兼容性等特点,受到了许多海外华人网站搭建者的欢迎。

一站式解决方案为你打造专业wordpress网站

  在当今数字化时代,对于外贸企业而言,拥有一个专业、易于管理的网站是取得成功的关键之一。然而,对于网络小白来… Continue reading 一站式解决方案为你打造专业wordpress网站