禁用WordPress的Embed功能 移除加载wp-embed.min.js文件
//禁用wordpress的文章嵌入功能 function disable_embeds_code_init() { // Remove the REST API endpoint. remove_action( 'rest_api_init', 'wp_oembed_register_route' ); // Turn off oEmbed auto discovery.
//禁用wordpress的文章嵌入功能 function disable_embeds_code_init() { // Remove the REST API endpoint. remove_action( 'rest_api_init', 'wp_oembed_register_route' ); // Turn off oEmbed auto discovery.
//去掉顶部工具栏 add_filter('show_admin_bar', '__return_false');相关阅读:https://boke112.com/bkwd/4093.html
// 隐藏左上角WordPress标志 function hidden_admin_bar_remove() { global $wp_admin_bar; $wp_admin_bar->remove_menu('wp-logo'); } add_action('wp_before_admin_bar_render', 'hidden_admin_bar_remove', 0
//移除头部wp_json链接 remove_action( 'wp_head', 'rest_output_link_wp_head', 10 ); remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
//移除HTTP header 中的 wp-json link remove_action( 'template_redirect', 'rest_output_link_header', 11, 0 );
// 禁用REST API /*禁用未登录的用户*/ add_filter( 'rest_api_init', 'rest_only_for_authorized_users', 99 ); function rest_only_for_authorized_users($wp_rest_server){ if ( !is_user_logged_in() ) { wp_d
remove_action( 'wp_print_styles' , 'print_emoji_styles');// 禁用emoji
//删除JS及CSS的版本查询字符串 function _remove_script_version ( $src ){ $parts = explode( '?', $src ); return $parts[0]; } add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); add_filter
//清除谷歌字体 function coolwp_remove_open_sans_from_wp_core() { wp_deregister_style('open-sans'); wp_register_style('open-sans', false); wp_enqueue_style('open-sans', ''); } add_action('init',
// WordPress连续ID,禁用草稿功能函数开始 function keep_id_continuous(){ global $wpdb; $lastID = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' OR post_status = 'draft'