Enter your keyword

Blog

How to Change Admin URL Without Plugin

Step 1: Configuration define in wp-config.php

define('WP_ADMIN_DIR', 'private-area');
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR); 

Step 2: Add a function in your theme functions.php file

add_filter('site_url',  'change_wpadmin_url', 10, 3);  
function change_wpadmin_url( $url, $path, $orig_scheme ) {
	$old_admin_url  = array( "/(wp-admin)/");
	$admin_dir = WP_ADMIN_DIR;
	$new_admin_url  = array($admin_dir);
	return preg_replace( $old_admin_url, $new_admin_url, $url, 1); 
}

Step 3: Add a line to .htaccess file

RewriteRule ^private-area/(.*) wp-admin/$1?%{QUERY_STRING} [L]

No Comments

Add your review

Your email address will not be published.

* Feilds are Required.