WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Plugin links not working (3 posts)

  1. gzhmr
    Member
    Posted 1 year ago #

    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 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.

  2. gzhmr
    Member
    Posted 1 year ago #

    ??

  3. gzhmr
    Member
    Posted 1 year ago #

    ughh!! simple syntax error!! Only had single underscores on the FILE paramater. _FILE_ -> __FILE__

Topic Closed

This topic has been closed to new replies.

About this Topic