Created
July 12, 2017 12:19
-
-
Save jacobovidal/5b93b8397261b19e0588dd1999dc5793 to your computer and use it in GitHub Desktop.
Disable default tags, emojis and resources in WordPress via functions.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable Emojis | |
*/ | |
remove_action('admin_print_styles', 'print_emoji_styles'); | |
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_filter('wp_mail', 'wp_staticize_emoji_for_email'); | |
remove_filter('the_content_feed', 'wp_staticize_emoji'); | |
remove_filter('comment_text_rss', 'wp_staticize_emoji'); | |
/** | |
* Disable XML-RPC.php | |
*/ | |
add_filter('xmlrpc_enabled', '__return_false'); | |
function remove_x_pingback($headers) | |
{ | |
unset($headers['X-Pingback']); | |
return $headers; | |
} | |
add_filter('wp_headers', 'remove_x_pingback'); | |
/** | |
* Disable unnecessary tags | |
*/ | |
remove_action('wp_head', 'rsd_link'); | |
remove_action('wp_head', 'wlwmanifest_link'); | |
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); | |
remove_action('wp_head', 'wp_resource_hints', 2); | |
add_filter('feed_links_show_comments_feed', '__return_false'); | |
remove_action('wp_head', 'wp_generator'); | |
remove_action('the_generator', 'dt_remove_wpversion'); | |
/** | |
* Disable resources | |
*/ | |
function disable_resources() | |
{ | |
wp_dequeue_script('wp-embed'); | |
} | |
add_action('wp_footer', 'disable_resources'); | |
/* | |
* Disable JSON API | |
*/ | |
remove_action('wp_head', 'rest_output_link_wp_head'); | |
remove_action('wp_head', 'wp_oembed_add_discovery_links'); | |
remove_action('template_redirect', 'rest_output_link_header', 11, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment