Last active
September 20, 2016 14:39
-
-
Save SteveBarnett/94df1a7b6159353baa5549149e4c040d to your computer and use it in GitHub Desktop.
Remove some of WordPress's junk
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 | |
function disable_wp_unwanted_stuff() { | |
// remove emoji js junk | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
wp_deregister_script( 'wp-embed' ); | |
// Remove the REST API endpoint. | |
remove_action('rest_api_init', 'wp_oembed_register_route'); | |
// Turn off oEmbed auto discovery. | |
// Don't filter oEmbed results. | |
remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10); | |
// Remove oEmbed discovery links. | |
remove_action('wp_head', 'wp_oembed_add_discovery_links'); | |
// Remove oEmbed-specific JavaScript from the front-end and back-end. | |
remove_action('wp_head', 'wp_oembed_add_host_js'); | |
remove_action('wp_head', 'wp_print_scripts'); | |
remove_action('wp_head', 'wp_print_head_scripts', 9); | |
remove_action('wp_head', 'wp_enqueue_scripts', 1); | |
} | |
// there's probably a better place than init for these... | |
add_action( 'init', 'disable_wp_unwanted_stuff' ); | |
/* tidy up nav li items */ | |
function trimmed_classes($classes, $item){ | |
return []; | |
} | |
add_filter('nav_menu_css_class' , 'trimmed_classes' , 10 , 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment