傻大憨

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的功能很强,通过文章形式,可以让wordpress文章,有多种形式来展示。并不是所有的主题都有wordpress的文章形式,如果想有文章形式,将以下代码添加到 functions.php文件中即可。

wordpress导入mysql数据库文件的方法及注意事项

在某些情况下,您可能需要将现有的 MySQL 数据库导入到新的 WordPress 安装中。本文将介绍如何导入 MySQL 数据库文件到 WordPress 以及需要注意的事项。

建一个外贸B2B独立站的费用预算1000元够吗

1000元可以作为建立外贸B2B独立站的最低预算起点,但要实现一个功能齐全、用户体验良好的站点,实际投入可能需要远超此数额。

WordPress外贸建站教程分享

  在数字化时代,拥有一个强大的在线存在对于外贸业务至关重要。WordPress作为一个强大且用户友好的建站平… Continue reading WordPress外贸建站教程分享

为古腾堡而生的轻量化建站解决方案

简站WordPress主题是一款与古腾堡编辑器配合最默契、使用体验最流畅的轻量级解决方案。

简站wordpress主题的三大特点

简站wordpress主题的三大特点 1、理念“崇尚简约、鄙视繁琐、化繁为简、实用即可。”简站wordpres… Continue reading 简站wordpress主题的三大特点