移除后台隐私相关页面

WordPress 4.9.6 版新增Privacy(隐私)设置,个人数据导出和删除工具,主要是为了兼容欧洲即将生效的通用数据保护条例,即 General Data Protection Regulation ,简称 GDPR。

对于我们只是在国内运营的博客,这些页面暂时没有必要,所以可以把后台隐私相关的内容屏蔽掉。

将代码添加到当前主题functions.php模板的最后。

add_action('admin_menu', function (){
global $menu, $submenu;
// 移除设置菜单下的隐私子菜单。
unset($submenu['options-general.php'][45]);
// 移除工具菜单下的相关页面
remove_action( 'admin_menu', '_wp_privacy_hook_requests_page' );
remove_filter( 'wp_privacy_personal_data_erasure_page', 'wp_privacy_process_personal_data_erasure_page', 10, 5 );
remove_filter( 'wp_privacy_personal_data_export_page', 'wp_privacy_process_personal_data_export_page', 10, 7 );
remove_filter( 'wp_privacy_personal_data_export_file', 'wp_privacy_generate_personal_data_export_file', 10 );
remove_filter( 'wp_privacy_personal_data_erased', '_wp_privacy_send_erasure_fulfillment_notification', 10 );
// Privacy policy text changes check.
remove_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'text_change_check' ), 100 );
// Show a "postbox" with the text suggestions for a privacy policy.
remove_action( 'edit_form_after_title', array( 'WP_Privacy_Policy_Content', 'notice' ) );
// Add the suggested policy text from WordPress.
remove_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_content' ), 1 );
// Update the cached policy info when the policy page is updated.
remove_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
},9);

貌似只需要有中文注释的两段就可以了

 

正文完
 0