WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use tabs plugin and load tab contents using ajax. The problem is: the plugin requires a solid .php file to be specified in href e.g.

<li><a href="ajax/content3-slow.php">Tab 3 (slow)</a></li>

You know this does not work well with WordPress. A callback here would have worked. Is there such fork available Or any other plugin?

share|improve this question
up vote 2 down vote accepted

You can always use the proper WordPress Ajax API (well not really an api) for example:

<li><a href="url to wp-admin/admin-ajax.php?action=my_ajax_tabs&tab=tab1">Tab 1</a></li>
<li><a href="url to wp-admin/admin-ajax.php?action=my_ajax_tabs&tab=tab2">Tab 2</a></li>

then you create a function that will respond to the ajax calls:

function do_my_tabs(){
    $tab = $_GET['tab'];
    switch ($tab){
    case "tab1":
        echo 'tab1 content';
    case "tab2":
        echo 'tab2 content';

and last just hook this function :

//if you want only logged in users to access this function use this hook
add_action('wp_ajax_my_ajax_tabs', 'do_my_tabs');

//if you want none logged in users to access this function use this hook
add_action('wp_ajax_nopriv_my_ajax_tabs', 'do_my_tabs');

//if you want both logged in users and guests to access this function then add both
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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