今の自分にできることを、集中し全力を尽くせ

info@example.com 000-000-0000

Do your best !

今の自分にできることを、集中し全力を尽くせ

WordPressで不要なコードを削除する方法をまとめました

全く需要のないWordPressの絵文字機能やその他のコードを無効にすることにより、ソースがすっきりとします。

下記のコードを「functions.php」に記述してください。

これだけで、出力機能を停止することができます。

// Emoji機能を無効にする方法
function disable_emojis() {
     remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
     remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
     remove_action( 'wp_print_styles', 'print_emoji_styles' );
     remove_action( 'admin_print_styles', 'print_emoji_styles' );     
     remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
     remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );  
     remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
     add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
add_action( 'init', 'disable_emojis' );


// oEmbed機能の無効化
remove_action('wp_head','rest_output_link_wp_head');
remove_action('wp_head','wp_oembed_add_discovery_links');
remove_action('wp_head','wp_oembed_add_host_js');


//バージョン情報を無効化
remove_action('wp_head','wp_generator');


// 外部の投稿ツール用タグの無効化
remove_action('wp_head','wlwmanifest_link');
remove_action('wp_head', 'rsd_link');


// RSSを無効化
remove_action('wp_head','feed_links',2);
remove_action('wp_head','feed_links_extra',3);


// prevとnextを無効化
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');


// 短縮URLを無効化
remove_action('wp_head', 'wp_shortlink_wp_head');

参考サイト
https://oxynotes.com/?p=10229

Side Contents

Category List

Archive List

タグ