Skip to content

Commit

Permalink
✨ 增加XML-RPC功能开关
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed May 9, 2023
1 parent 414f0d8 commit e2e5257
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion inc/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function deel_setup()
remove_action('wp_head', 'wp_generator');//移除WordPress版本号
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);//本页短链接

add_filter('xmlrpc_enabled', '__return_false');
add_filter('embed_oembed_discover', '__return_false');
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'wp_oembed_add_host_js');
Expand All @@ -31,6 +30,10 @@ function deel_setup()
});
}

if(pk_is_checked('close_xmlrpc')){
add_filter('xmlrpc_enabled', '__return_false');
}

// 移除头部 wp-json 标签和 HTTP header 中的 link
remove_action('wp_head', 'rest_output_link_wp_head', 10);
remove_action('template_redirect', 'rest_output_link_header', 11);
Expand Down
6 changes: 6 additions & 0 deletions inc/setting/options/OptionGlobal.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ function get_fields(): array
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'close_xmlrpc',
'label' => __('禁止使用', PUOCK) . ' XML-RPC',
'type' => 'switch',
'sdt' => false,
],
[
'id' => 'thumbnail_rewrite_open',
'label' => __('缩略图伪静态', PUOCK),
Expand Down

0 comments on commit e2e5257

Please sign in to comment.