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.

I'm developing a plugin with the latest version of WordPress (3.4.2) locally (XAMPP 1.7.7 [PHP: 5.3.8]) and for some reason the links are not working within the plugin. I just have a simple delete link that links to a 'delete-gallery.php' file from within the plugin admin page. This file (delete-gallery.php) only calls a function to delete the record from the database and redirects back to the page that called it (the plugin admin page). Simple enough. But, when the link is clicked I get directed to XAMPP root (localhost:8080/xampp) and not the requested destination (delete-gallery.php) for some reason.

$url = plugins_url('includes/delete-gallery.php', _FILE_);
echo '<a href="'.$url.'?gallery_id='.$gallery['gallery_id'].'">Delete</a>';

I know the hrefs' path is correct on the link because it shows up in the status bar on hover, but for some reason it's not locating the file locally on submission. If I set the destination to somewhere external (ie. google.com, etc) it works fine, but not locally within wordpress.

The permalink structure has been updated and the .htaccess file is currently as so:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If I use a blank .htaccess file I don't get redirected to the XAMPP root, but instead get the 404 error 'Object not found! The requested URL was not found on this server. ...' when the link is clicked.

Is there something that needs to be set in .htaccess to allow redirecting locally within wordpress? I'm at a loss here. Any suggestions would be greatly appreciated.

share|improve this question

closed as too localized by toscho Oct 13 '12 at 17:21

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
I think __FILE__ is right way. ( Note the double underscores ) –  amit Oct 13 '12 at 10:17
2  
Wow! That was it. I must have overlooked that a hundred times looking over the code. Thanks for your help Amit... –  gzhmr Oct 13 '12 at 15:34

1 Answer 1

Simple syntax error that went unnoticed in the FILE parameter. Had single underscores instead of doubles.

share|improve this answer

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