Advertisement
Guest User

hide wp-admin / wp-login

a guest
Jul 5th, 2013
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # this on top of .htaccess:
  2. #----------------------------------
  3.  
  4. RewriteEngine On
  5. RewriteRule ^login\.php?(.*) /wp-login.php?$1 [L]
  6. RewriteRule ^admin/(.*) /wp-admin/$1 [L]
  7.  
  8.  
  9. # this for functions.php:
  10. #---------------------------------
  11.  
  12. add_filter('admin_url', 'wpadmin_filter');
  13.  
  14. function wpadmin_filter($url)
  15. {
  16.    $url = str_replace('wp-admin', 'admin', $url);
  17.    return $url;
  18. }
  19.  
  20. add_filter('site_url',  'wplogin_filter', 10, 3);
  21.  
  22. function wplogin_filter( $url, $path, $orig_scheme )
  23. {
  24.    $url = str_replace('wp-login.php','login.php', $url);
  25.    return $url;
  26. }
  27.  
  28. add_action( 'after_setup_theme', 'obfuscate_urls' );
  29.  
  30. function obfuscate_urls() {
  31.  if( strpos($_SERVER['REQUEST_URI'], 'wp-login') ||
  32.      strpos($_SERVER['REQUEST_URI'], 'wp-admin') )  {
  33.    global $wp_query;
  34.    $wp_query->set_404();
  35.    status_header( 404 );
  36.    include( get_404_template() );
  37.    exit;
  38.  }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement