Skip to content

Instantly share code, notes, and snippets.

@almone
Last active October 20, 2018 06:27
Show Gist options
  • Select an option

  • Save almone/5c7da2870a720df52247 to your computer and use it in GitHub Desktop.

Select an option

Save almone/5c7da2870a720df52247 to your computer and use it in GitHub Desktop.

Revisions

  1. almone revised this gist Feb 11, 2016. 1 changed file with 19 additions and 2 deletions.
    21 changes: 19 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -18,11 +18,28 @@ function cleanup_head() {
    remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); // Shortlink
    remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); // Links for adjacent posts
    remove_action('wp_head', 'wp_generator'); // WP version
    remove_action('wp_head', array(visual_composer(), 'addMetaData')); // Visual Composer
    // remove_action('wp_head', array(visual_composer(), 'addMetaData')); // Visual Composer
    }

    // Remove Slider Revolution meta tag
    add_filter('revslider_meta_generator', 'remove_revslider_meta_tag');
    function remove_revslider_meta_tag() {
    return '';
    }
    }

    // Remove All Yoast HTML Comments
    // https://gist.github.com/paulcollett/4c81c4f6eb85334ba076
    if (defined('WPSEO_VERSION')){
    add_action('get_header',function (){ ob_start(function ($o){
    return preg_replace('/\n?<.*?yoast.*?>/mi','',$o); }); });
    add_action('wp_head',function (){ ob_end_flush(); }, 999);
    }

    // Remove version param from any enqueued scripts
    function remove_wp_ver_css_js( $src ) {
    if ( strpos( $src, 'ver=' ) )
    $src = remove_query_arg( 'ver', $src );
    return $src;
    }
    add_filter( 'style_loader_src', 'remove_wp_ver_css_js', 9999 );
    add_filter( 'script_loader_src', 'remove_wp_ver_css_js', 9999 );
  2. almone revised this gist Feb 7, 2016. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,11 @@ function cleanup_head() {
    remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); // Shortlink
    remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); // Links for adjacent posts
    remove_action('wp_head', 'wp_generator'); // WP version
    remove_action('wp_head', array(visual_composer(), 'addMetaData')); // Visual Composer
    }

    // Remove Slider Revolution meta tag
    add_filter('revslider_meta_generator', 'remove_revslider_meta_tag');
    function remove_revslider_meta_tag() {
    return '';
    }
  3. almone created this gist Feb 7, 2016.
    21 changes: 21 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    // Clean wp_head from junk
    add_action('after_setup_theme', 'start_cleanup');
    function start_cleanup() {
    // Initialize the cleanup
    add_action('init', 'cleanup_head');
    }

    // WordPress cleanup function
    function cleanup_head() {
    remove_action('wp_head', 'rsd_link'); // EditURI link
    remove_action('wp_head', 'feed_links_extra', 3); // Category feed links
    remove_action('wp_head', 'feed_links', 2); // Post and comment feed links
    remove_action('wp_head', 'wlwmanifest_link'); // Windows Live Writer
    remove_action('wp_head', 'index_rel_link'); // Index link
    remove_action('wp_head', 'parent_post_rel_link', 10, 0); // Previous link
    remove_action('wp_head', 'start_post_rel_link', 10, 0); // Start link
    remove_action('wp_head', 'rel_canonical', 10, 0); // Canonical
    remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); // Shortlink
    remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); // Links for adjacent posts
    remove_action('wp_head', 'wp_generator'); // WP version
    }