Trying to load content of a post via AJAX

If your javascript action is named ajaxify, then these should be:

add_action('wp_ajax_ajaxify', 'ajaxify'); // ajax for logged in users
add_action('wp_ajax_nopriv_ajaxify', 'ajaxify'); // ajax for not logged in users

the actions you hook are a concatenation of wp_ajax_(nopriv_) and your action name. the function that’s hooked to that action can have any name, so it could be:

add_action('wp_ajax_ajaxify', 'some_random_function_name');
add_action('wp_ajax_nopriv_ajaxify', 'some_random_function_name');

Leave a Comment