Created
October 30, 2014 21:18
-
-
Save andrezrv/f7a083627f3bd89c3d9e to your computer and use it in GitHub Desktop.
Obtain path to wp-admin directory in WordPress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. | |
$admin_path = str_replace( get_bloginfo( 'url' ) . '/', ABSPATH, get_admin_url() ); | |
// Make it filterable, so other plugins can hook into it. | |
$admin_path = apply_filters( 'my_plugin_get_admin_path', $admin_path ); | |
return $admin_path; | |
} |
Forked to modify so that if url's contain a mix of http and https, function still works.
$admin_directory = ABSPATH.'/wp-admin/';
Only if admin directory is left as standard. It might be changed as a security measure.
Nope it might not, it's hardcoded as well in the core and in so much stuff, you cannot rename or move this directory, not the same for other dirs like WP_CONTENT_DIR or WP_PLUGIN_DIR which can be changed and thus have a defined constant
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$admin_directory = ABSPATH.'/wp-admin/';