Last Updated: February 25, 2016
·
1.19K
· acefxlabs

Hide your wordpress source and feed from public

This works perfectly and visitors cant even tell what framework is used on my sites

remove_action('wp_head', 'wp_generator');

function disable_our_feeds() {
    wp_die( __('<strong>Error:</strong> No RSS Feed Available, Please visit our <a href="'. get_bloginfo('url') .'">homepage</a>.') );
}

add_action('do_feed', 'disable_our_feeds', 1);
add_action('do_feed_rdf', 'disable_our_feeds', 1);
add_action('do_feed_rss', 'disable_our_feeds', 1);
add_action('do_feed_rss2', 'disable_our_feeds', 1);
add_action('do_feed_atom', 'disable_our_feeds', 1);




function roots_head_cleanup() {
  remove_action('wp_head', 'feed_links', 2);
  remove_action('wp_head', 'feed_links_extra', 3);
  remove_action('wp_head', 'rsd_link');
  remove_action('wp_head', 'wlwmanifest_link');
  remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
  remove_action('wp_head', 'wp_generator');
  remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);

  //Remove Header Stuffs
    // remove junk from head
    remove_action('wp_head', 'index_rel_link');
    remove_action('wp_head', 'feed_links_extra', 3);
    remove_action('wp_head', 'start_post_rel_link', 10, 0);
    remove_action('wp_head', 'parent_post_rel_link', 10, 0);
    remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);

  global $wp_widget_factory;
  remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style'));

  add_filter('use_default_gallery_style', '__return_null');
}
add_action('init', 'roots_head_cleanup');

6 Responses
Add your response

I was just looking for this ..........

where should i put it ??

over 1 year ago ·

Just put it in the functions.php file

over 1 year ago ·

You have this twice:
remove_action('wp_head', 'wp_generator');

over 1 year ago ·

Thanks bro for the notice, guess it was while i was ensuring bruteful approach

over 1 year ago ·

Are you saying that this also gets rid of the /wp-includes/ | /wp-content/ | /wp-admin/ parts in the URLs of scripts and styles? Obviously you can easily change the name of the wp-content directory, but this doesn't go for the admin and includes directories.

The easiest thing for me to notice is when one of the resources comes from one of the above-mentioned URLs. This tells me that the site is powered by WordPress right away.

over 1 year ago ·

It wont remove your directories but you can rename directories and block unwanted access using .htaccess

over 1 year ago ·