傻大憨

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搜索结果只关联标题

wordpress搜索结果只关联标题,不关联内容。

简站wordpress主题的三大特点

简站wordpress主题的三大特点 1、理念“崇尚简约、鄙视繁琐、化繁为简、实用即可。”简站wordpres… Continue reading 简站wordpress主题的三大特点

删除wordpress版本号代码

一段代码就可以删除wordpress的版本号,掌握这些就可以自己制作主题系列。