Skip to content

Instantly share code, notes, and snippets.

@dkomando
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkomando/be4ba7929a84a8d3877e to your computer and use it in GitHub Desktop.
Save dkomando/be4ba7929a84a8d3877e to your computer and use it in GitHub Desktop.
// Place the following in your WordPress child themes function file.
// Some security is better than no security.
// ------------------------------------------------------------------
// /wp-content/themes/%YourTheme|YourChildTheme%/functions.php
// QUICK SECURITY ADDITIONS
// Remove all references of WP Version from included JS/CSS
function remove_cssjs_verz($src){
global $wp_version;
$remove_ver = array("?ver=".$wp_version,"&ver=".$wp_version,"&ver=".$wp_version,"&ver=".$wp_version);
$src = str_replace($remove_ver,"",$src);
$src = esc_url(remove_query_arg("ver",$src));
if(!empty($src)){return $src;}
}
add_filter('style_loader_src','remove_cssjs_verz',1000);
add_filter('script_loader_src','remove_cssjs_verz',1000);
// Remove the WordPress version.
function no_generator(){return "";}
add_filter('the_generator','no_generator');
remove_action('wp_head','wp_generator');
// Remove unnecessary error messages on failed log-ins.
function explain_less_login_issues(){ return "<strong>ERROR</strong>: Entered credentials are incorrect.";}
add_filter('login_errors','explain_less_login_issues');
// Disable XML-RPC - You may or my not want this.
add_filter('xmlrpc_enabled','__return_false');
// /QUICK SECURITY ADDITIONS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment