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

为什么有些主题不支持elementor?

elementor是wordpress的一个第三方的插件,不是所有的wordpress主题,都必须要支持elementor

揭秘成功WordPress外贸建站的关键要素

在当今数字化时代,通过WordPress建立外贸网站已经成为许多企业成功开展国际贸易的关键要素之一。本文将揭秘… Continue reading 揭秘成功WordPress外贸建站的关键要素

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

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

北京无极花专业的韩语网站建设与韩国海外市场推广服务

无极花建站通过其一站式服务,帮助企业不仅在韩国市场站稳脚跟,还能通过专业的SEO优化和数字营销策略,提升品牌知名度和用户转化率。

把Emojis表情符号从wordpress头部去掉

如果你的网站不需要显示mojis表情符号,可以通过在functions.php文件中添加一段代码来去掉

外贸SOHO建站

外贸SOHO建站是一个系统性工程,需要从前期准备、网站设计、SEO优化到推广等多个方面综合考虑。通过合理规划和执行,可以有效地提升网站的曝光率和询盘量,从而实现业务的增长和发展。