傻大憨

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作为一款功能强大、易于使用的建站平台,受到了众多外贸企业的青睐。

为什么选择WooCommerce构建跨境电商独立站

从服务器与环境部署、WooCommerce及商业主题安装配置、多语言多币种与跨境支付接入、UI视觉定制、SEO基础架构优化,到后期迁移与运维答疑,WodeShop为外贸企业与跨境卖家提供全流程技术托底。

自建外贸站群与租用外贸网站的比较分析

自建外贸站群和租用外贸网站各有优劣,适用于不同的业务场景和需求。在实际操作中,企业应根据自身的实际情况和需求,综合考虑成本、灵活性、定制性、品牌建设与推广以及风险与稳定性等因素,选择最适合自己的外贸网站策略。

WooCommerce定制开发的优势和使用盗版模板的风险

为什么说建WooCommerce独立站时一定要定制,不要用模板,即使用模板,也要找模板的开发者购买,千万不要用盗版模板,盗版模板危害极大。

wordpress sql文件导入mysql数据库时常见问题分析

当涉及到将数据从 SQL 文件导入到 WordPress 数据库时,可能会遇到各种错误。

为wordpress特定分类目录下的内容添加自定义字段

为wordpress特定分类目录下的内容添加自定义的字段,并且只在该分类下的内容录入时显示