The question is about which way is the best / easiest way to make a theme with ajax, using admin-ajax.php or normally. I ask because I see that complicates using admin-ajax.php for everything and use jquery plugin to enable your browser history for example.

that think?

Sorry for my English!!!

  • 3
    What does normally mean? This is default way in WordPress to use ajax: codex.wordpress.org/AJAX_in_Plugins and you do not have to use just jQuery. You can enqueue mootools or other js, or just use pure js Jan 28, 2013 at 12:45
  • Normally is without using admin-ajax
    – kallookoo
    Jan 28, 2013 at 14:25
  • admin-ajax is recomended and thoug normal way to use Ajax in WordPress... Jan 28, 2013 at 14:42

1 Answer 1


Never ever use your theme/plugin files directly for ajax calls, always use admin-ajax.php. This is the only recommended way of doing ajax to ensure maximum compatibility with wordpress (including future versions) & 3rd party plugins/themes

The best/easiest way depends on the situation & is debatable but i would ask you to use admin-ajax.php even if it is hard or inefficient

  • the situation is make one theme 100% ajax, posts, pages, search, etc.. but I have one problem to implement wp_query with admin-ajax
    – kallookoo
    Jan 28, 2013 at 14:29
  • @user11721 - if you have a specific issue with using WP_Query with admin-ajax.php, then ask a new question with details of that specific issue.
    – Milo
    Jan 28, 2013 at 16:18
  • agree, but my question in using admin-ajax is exactly how I do, because since the function ajax_call for example not find out how to return the page I want to visit. Since it I consider it to make a WP_Query and not return the body_class , wp_footer (for scripts that usage on some pages) and one problem I encounter is with next-page of the post, which pagename=post/second page not works.
    – kallookoo
    Jan 31, 2013 at 20:02

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.