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文章

创业公司用WordPress搭建官网的好处

随着科技的迅速发展和互联网的广泛普及,官网已经成为创业公司展示形象、吸引投资和用户的重要窗口。而在众多建站工具中,WordPress因其易用性、灵活性和强大的社区支持,成为越来越多创业公司的首选。

模板之家mymoban

通过模板之家,用户可以找到适合各种需求的模板,无论是个人项目还是商业用途,都能找到合适的解决方案。

wordpress指定父分类调用子分类名称

在任意位置都可以实现,指定ID父分类调用子分类名称

简站V20博客主题

简站V20博客主题是一款以简洁、实用、无插件和更安全为特点的WordPress主题。简站V20博客主题以其简洁实用的设计,以及对安全性的重视,成为了许多网站开发者和用户的首选。