menu
Webを活用してお客様のビジネス課題を解決します。札幌・東京を拠点にWebコンサルティングをコアにした、Web制作・システム開発・サーバ構築会社です。
現場ブログ

WordPressインストールしたらする諸々

fシェアする
ツイートする
ブックマーク
タイトルとURLをコピー

最終更新日:2018/12/27   公開日:2017/01/17

こんにちは、中村です。

 

世界的によく使われているWordPress、セキュリティやいろんなことを考えていつもやっていることを載せておきます。(他にもやっておいたほうがいいのとかもありそう)

# WordPressのバージョンを消す
remove_action(‘wp_head’, ‘wp_generator’);

# css, jsのバージョンを消す
function remove_css_js( $src ) {
if (strpos($src, ‘ver=’))
$src = remove_query_arg(‘ver’, $src);
return $src;
}
add_filter(‘style_loader_src’, ‘remove_css_js’, 9999);
add_filter(‘script_loader_src’, ‘remove_css_js’, 9999);

# ドメイン削除
function callback($buffer){
$buffer = str_replace(“http://example.com/”, “/”,$buffer);
return $buffer;
}
ob_start(“callback”);

remove_filter(‘the_content’, ‘wpautop’);
remove_action(‘wp_head’, ‘feed_links_extra’, 3 );
remove_action(‘wp_head’, ‘feed_links’, 2 );
remove_action(‘wp_head’, ‘rsd_link’ );
remove_action(‘wp_head’, ‘wlwmanifest_link’ );
remove_action(‘wp_head’, ‘index_rel_link’ );
remove_action(‘wp_head’, ‘parent_post_rel_link’, 10, 0 );
remove_action(‘wp_head’, ‘start_post_rel_link’, 10, 0 );
remove_action(‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0 );
remove_action(‘wp_head’, ‘wp_shortlink_wp_head’);
remove_action(‘wp_head’,’wp_oembed_add_discovery_links’);
remove_action(‘wp_head’,’rest_output_link_wp_head’);

# 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’ );

 

案件によってはずしたりプラスαもあるんですが、、。

逐次アップデートしていかないとですね。