This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31105
    pbpyrojust18pbpyrojust18
    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
    Ernest MarcinkoErnest Marcinko
    Keymaster

    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.

    #31127
    pbpyrojust18pbpyrojust18
    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
    Ernest MarcinkoErnest Marcinko
    Keymaster

    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.

    #31145
    pbpyrojust18pbpyrojust18
    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.