Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Debloat Wordpress

<?php

if ( ! defined( 'ABSPATH' ) ) die(); // prevent direct access

// Clean up Wordpress <head>
remove_action('wp_head', 'rsd_link'); // remove really simple discovery link
remove_action('wp_head', 'wp_generator'); // remove Wordpress version
remove_action('wp_head', 'feed_links', 2); // remove rss feed links (make sure you add them in yourself if youre using feedblitz or an rss service)
remove_action('wp_head', 'feed_links_extra', 3); // removes all extra rss feed links
remove_action('wp_head', 'index_rel_link'); // remove link to index page
remove_action('wp_head', 'wlwmanifest_link'); // remove wlwmanifest.xml (needed to support windows live writer)
remove_action('wp_head', 'start_post_rel_link', 10, 0); // remove random post link
remove_action('wp_head', 'parent_post_rel_link', 10, 0); // remove parent post link
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); // remove the next and previous post links
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);

function smartwp_remove_wp_block_library_css(){
  // wp_dequeue_style( 'wp-block-library' );
  // wp_dequeue_style( 'wp-block-library-theme' );
  wp_dequeue_style( 'wc-block-style' ); // Remove WooCommerce block CSS
} 
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );

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_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 );
}
add_action( 'init', 'disable_emojis' );

function disable_emojis_tinymce( $plugins ) {
  if ( is_array( $plugins ) ) {
    return array_diff( $plugins, array( 'wpemoji' ) );
  } else {
    return array();
  }
}

function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {
  if ( 'dns-prefetch' == $relation_type ) {
    $emoji_svg_url = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' );
    $urls = array_diff( $urls, array( $emoji_svg_url ) );
  }

  return $urls;
}

?>
Comment

PREVIOUS NEXT
Code Example
Php :: Regenerate session ID and remove all session data 
Php :: phpunit 7 requirement php 
Php :: laravel-filemanager showing blank page 
Php :: Dynamic modal name appending in laravel 
Php :: stripe cb test 
Php :: how to download file in laravel 8 delelete from directry 
Php :: Laravel docker-compose 404 not found Nginx 
Php :: shop manager Redirect @ WooCommerce 
Php :: OroCRM Custom Bundle is loaded? 
Php :: php parse_url array function 
Php :: ErrorException Undefined index(laravel 7 array helpers) 
Php :: Type cast using int php 
Php :: laravel How to apply Eloquent where() to child in hasMany() relationship 
Php :: how to follow unfollow on buddypress ajax call 
Php :: laravel - How to concatenate URL and retrieve images from database in json format 
Php :: Google Dorks Using special search string for Web Server Detection 
Php :: wordpress show notice only on plugin page 
Php :: how to override category product from seo title and description 
Php :: ass 
Php :: enfold remove debugging info for theme support 
Php :: php list all files in directory and subdirectories 
Php :: base64_decode 
Php :: prestashop get product id 
Php :: laravel facade 
Php :: how to wp create post type in wordpress 
Php :: how to grab shortcode from custom post type 
Php :: phpstorm deployment 
Java :: Cannot fit requested classes in a single dex file 
Java :: java console text color 
Java :: gson java maven dependency script google json repository 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =