Wordpress禁用 Auto OEmbed

Function代码

//禁用 Auto OEmbed,by minirizhi.com
remove_filter( 'the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
remove_action( 'rest_api_init', 'wp_oembed_register_route' );
remove_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
add_filter( 'embed_oembed_discover', '__return_false' );
remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 );
remove_filter( 'oembed_response_data',   'get_oembed_response_data_rich',  10, 4 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
add_filter( 'tiny_mce_plugins', 'wecho_disable_post_embed_tiny_mce_plugin' );
function wecho_disable_post_embed_tiny_mce_plugin($plugins){
    return array_diff( $plugins, array( 'wpembed' ) );
}
add_filter('query_vars', 'wecho_wpjam_disable_post_embed_query_var');
function wecho_wpjam_disable_post_embed_query_var($public_query_vars) {
    return array_diff($public_query_vars, array('embed'));
}
文章目录