I use a Ajax query to show some content, but I can’t use any of my plugins functions.
Javascript :
$('#load_more').click(function() {
var data = {
action: 'load_more',
id: $("input#id").val()
};
jQuery.post(ajaxurl, data, function(response) {
$("#content").append(response);
});
});
PHP in functions.php :
function load_more(){
$id = intval($_POST['id']);
if(!isset($id) or !is_numeric($id)){
echo "Error";}
else {
$works = plugin_function($id);
wordpress_function_works($id, $works);}
die;
}
add_action('wp_ajax_load_more', 'load_more');
add_action('wp_ajax_nopriv_load_more', 'load_more');
The Ajax works fine, it can call & work with any of my wordperss functions. But when I call a plugin function, it returns an error Call undefined function plugin_function() line...
PS: ajaxurl = /wp-admin/admin-ajax.php