Skip to content

Instantly share code, notes, and snippets.

@earth3300
Last active August 30, 2018 18:43
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 earth3300/6056f7557788b9517c6963dfcf65347c to your computer and use it in GitHub Desktop.
Save earth3300/6056f7557788b9517c6963dfcf65347c to your computer and use it in GitHub Desktop.
Changes the WP /wp-admin url to /admin for for consistency and standardization purposes.
/**
* Change the /wp-admin url to /admin
*
* Adapted from {@link https://gist.github.com/hakre/701245}
*/
class WPAdminUrl {
/**
* The instance of the class
*/
static $instance;
/**
* Bootstrap function
*/
static public function bootstrap() {
null === self::$instance
&& self::$instance = new self()
;
return self::$instance;
}
/**
* The cookie path has been set already (see config).
*/
public function __construct() {
add_action('init', array($this, 'init'));
}
/**
* Filter the admin url
*/
public function init() {
add_filter('admin_url', array($this, 'admin_url'), 10, 3);
}
/**
* Provide the admin url set in /config
*/
public function admin_url() {
return SITE_ADMIN_URL . '/';
}
}
return WPAdminUrl::bootstrap();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment