Skip to content

Instantly share code, notes, and snippets.

@tazziedave
tazziedave / get-admin-path.php
Last active October 14, 2018 10:17 — forked from andrezrv/get-admin-path.php
Obtain path to wp-admin directory in WordPress.
<?php
/**
* Obtain the path to the admin directory.
*
* @return string
*/
function my_plugin_get_admin_path() {
// Replace the site base URL with the absolute path to its installation directory.
$blogUrl = preg_replace("(^https?://)", "", get_bloginfo( 'url' ));
$adminUrl = preg_replace("(^https?://)", "", get_admin_url());