Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a better way of retrieving the path of admin.php and the url of wp-admin.css?

What I can think of is:

$adminphppath = ABSPATH . '\wp-admin\admin.php';
$admincssurl = get_bloginfo('wpurl') . '/wp-admin/css/wp-admin.css";

But, some may be changing the admin path for security. So I need a more reliable way.

[Edit] I need the system path for admin.php, not url. Because I need to include it.

share|improve this question
    
You cannot change the wp-admin folder name. You can rewrite it url wise but it ain't going to make anything more secure. –  Wyck Aug 20 '12 at 3:30
    
So is ABSPATH the most reliable way? –  Teno Aug 20 '12 at 5:17
    
yes, yes it is. –  Wyck Aug 20 '12 at 5:31
add comment

1 Answer

up vote 1 down vote accepted

You can use admin_url() function for wp-admin.css file and ABSPATH for admin.php.

$admin_php_path = ABSPATH . '/wp-admin/admin.php';
$admin_css_url = admin_url( 'css/wp-admin.css' );
share|improve this answer
    
For the css file it works thanks but for admin.php, actually I need to use include() so I need the system path, not the url. If I include with url, I get Warning: require() [function.require]: http:// wrapper is disabled in the server configuration by allow_url_include=0 –  Teno Aug 20 '12 at 2:59
    
O, sorry about that. admin_url() will return URL which is useless with require or include, so as @Wyck said you should use ABSPATH. Updated answer. –  Mamaduka Aug 20 '12 at 7:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.