I have to build a WordPress plugin which gives out HTML for an AJAX call. However, because of the server environment I cannot use the traditional admin-ajax.php.

Someone told me that I could build a custom page using url-rewrite ex: /my-ajax-calls/

So when I send a request to that page it would be:


Then I could use param1 & param2 and give the appropriate HTML.

I know how to build plugins, how do I rewrite the URL to connect it with a method that generates the HTML?

  • 2
    Please reformat your Q (you have wysiwyg editor buttons on top). And also please don't use dialect words like "becoz". This is a public page and not private chat.
    – kaiser
    Jan 13, 2012 at 19:53

1 Answer 1


You can simply target to a custom file when using wp_localize_script(). Just - in the third argument-array - set ajax_url to whatever file you want to target.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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