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

打造专业WP外贸建站平台功能全面解析

  在全球化的商业环境中,拥有一个专业且高效的外贸网站对于企业的成功至关重要。WordPress作为一款强大而… Continue reading 打造专业WP外贸建站平台功能全面解析

同一个数据库安装两个或多个wordpress网站方法

同一个数据库内怎么安装多个wordpress网站。

“简站”是一个WordPress主题

“简站”是一个WordPress主题,它通常以其简洁、现代的设计和易于使用的特点受到用户的喜爱。

莫卧儿专业的帝国CMS模板平台

莫卧儿mowoer.com专业的帝国CMS模板平台是一个专注于提供帝国CMS模板的资源平台。

简洁、实用且安全的WordPress主题

简站WordPress主题是一个以简洁、实用、无插件和安全性高为特点的WordPress主题。它采用扁平化设计… Continue reading 简洁、实用且安全的WordPress主题

SEO模板网站的wordpress主题最适合google外贸SEO

选择适合您外贸网站的WordPress主题时,考虑上述因素将帮助您创建一个不仅美观,而且对搜索引擎友好的网站,从而提高您的外贸业务可见性和转化率。