making sense of admin-ajax

So I’m working with ThemeTrust’s “reveal” theme, and there is an ajaxed in chunk-of-content that I’m really trying to change (grab custom meta fields (images) + insert into a slideshow). As far as I can tell the following piece of code grabs the content from the normal tinymce box and drops it in the #projectHolder div – but I can’t figure out how to piggyback my php code on this request.

function loadProject(projectSlug) { 
// Scroll to the top of the projects    
        action : 'myajax-submit',           
        slug : projectSlug
    function( response ) {   

I suppose my answer lies somewhere in the 1500+ lines of wp-admin/admin-ajax.php but that seems awful daunting…

Solutions Collecting From Web of "making sense of admin-ajax"

The function that returns the contents of that ajax request will not be in admin-ajax.php. That is the core WordPress file that handles ajax requests, but it is not used for specifying the data returned by ajax functions in themes / plugins.

In the theme (somewhere), will be a line that looks like this:

add_action('wp_ajax_myajax-submit', 'some_function_name_here');

The function called “some_function_name_here” (which will be named something different than some_function_name_here, as this is just an example) is what determines the data returned to jQuery.

Do a search in the theme files for “add_action(‘wp_ajax_myajax-submit'” and you should be able to find it.

If you don’t find it with that search, then look for