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外贸建站平台至关重要。本文将为您一一解读… Continue reading WordPress外贸建站平台功能与优势一览

网络建站模板资源网站

这些网站各有特色,用户可以根据自己的需求选择合适的资源进行网站搭建。无论是追求美观设计、SEO优化,还是个性化定制,都能在这些平台上找到满意的解决方案。

wordpress任意位置调用指定ID页面的内容

在制作wordpress主题时,有时需要在一些位置调用一些特殊页面的内容。比如,在某个位置调用一段简介之类的。

建易独立站的功能和服务

建易独立站通过专业的建站服务和丰富的功能支持,能够帮助跨境电商企业快速搭建并运营自己的独立站,提升品牌竞争力。

如何在wordpress顶部header.php中引用css/bootstrap.css文件

在 WordPress 的 header.php 文件中引用 CSS 文件(如 bootstrap.css)是实现主题样式化的一种常见方式。以下是具体的步骤和代码示例

WordPress外贸建站程序对比

  在选择建站引擎时,WordPress是许多企业和个体创业者的首选。然而,WordPress本身有各种不同的… Continue reading WordPress外贸建站程序对比