Skip to content

Instantly share code, notes, and snippets.

@agrogeek
Created March 18, 2021 06:18
Show Gist options
  • Save agrogeek/1946e61319cdb76bb1c13bc2c8253040 to your computer and use it in GitHub Desktop.
Save agrogeek/1946e61319cdb76bb1c13bc2c8253040 to your computer and use it in GitHub Desktop.
Optimizaciones para WordPress (jquery migrate, pingbacks, emojis)
/* Desahbilitar jquery migrate */
function montanera_remove_jquery_migrate( &$scripts ) {
if( !is_admin() ) {
$scripts->remove( 'jquery' );
$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.12.4' );
}
}
add_filter( 'wp_default_scripts', 'montanera_remove_jquery_migrate' );
/* Deshabilitar pingbacks */
function disable_pingback( &$links ) {
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, get_option( 'home' ) ) )
unset($links[$l]);
}
add_action( 'pre_ping', 'disable_pingback' );
/* Deshabilitar emojis */
add_action( 'init', 'deshabilitar_emojis' );
function deshabilitar_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_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment