Jump to content

rewrite wordpress admin-ajax.php url


inferno-prime
 Share

Recommended Posts

I found a topic here That looks like it mite work. Now I did try this but I get a post 404 on the new ajax url which is /ajax/ which then I can't do anything in the dashboard. I would told the api was not meant for this but honestly I don't know what to say as long as the code works I really don't see a problem with using it. BTW I am using this code :

// This will change the url for admin-ajax.php to /ajax/
function modify_adminy_url_for_ajax( $url, $path, $blog_id ) {
    if ( 'admin-ajax.php' == $path ) {
        $url = site_url('/ajax/');
    }

    return $url;
}
add_filter( 'admin_url', 'modify_adminy_url_for_ajax', 10, 3 );

And this goes into the .htaccess

RewriteRule ^/?ajax/?$ /wp-admin/admin-ajax.php?&%{QUERY_STRING} [L,QSA]

 

Link to comment
Share on other sites

  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.