Use alternative ajax request to admin-ajax.php

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Use alternative ajax request to admin-ajax.php

This topic contains 4 replies, has 2 voices, and was last updated by

 
Participant
1 year ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31105

    Participant

    Is it possible to use an alternative ajax url instead of /wp-admin/admin-ajax.php ? The backend_ajaxurl for ASP is /wp-admin/admin-ajax.php. Can I change that? It is fine for our development environments, but when we deploy to our QA and PROD environments which are on www domains we block any access or requests to /wp-admin/ for security reasons. Is there a php hook, snippet, or anything I can do with ASP to change the backend_ajaxurl ? Or point me to some docs for some help? I’ve been looking into some ways to do, but I wanted to reach our to you first. Thanks.

    #31120

    Hi,

    I would not recommend doing that whatsoever, as the ajax URL is a wordpress core feature – all the plugins, as well as the wordpress core is using that. Unfortunately I don’t know if that is possible to change securely, I would not recommend moving that file though, or blocking public access from it. You could maybe try blokcing the rest of the folder, and make an exception to it somehow.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31127

    Participant

    Thanks for that info. Is it at least possible to create a WordPress hook to change the value of "admin_url" => admin_url(), or make it relative so it doesn’t use an absolute URL?

    #31131

    I guess there is a hook somewhere. Check the source of the get_admin_url, there might be something there. But again, I really don’t recommend tempering with these URIs if possible.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31145

    Participant

    I fixed the issue we were having. It was a CORS Policy cross domain issue. No need to try to hack something together. Everything is working correctly now. Thanks for your info.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.