If I have these classes
class something { public function __construct() { add_action('wp_ajax_ajax_func', array( $this, 'ajax_func' ) ); } public function ajax_func() { } } class stchild extends something { public function __construct() { } public function ajax_func() { echo "Test child1"; } }
How to call only ajax_func function in stchild ajax class?
when i try this code
jQuery.ajax({ url: 'admin-ajax.php', data: {action : 'ajax_func'}, success: function(data){ console.log(data); } });
it gets all the functions called ajax_func , I want to define a specific class to get this function from it. Note that there are many child classes from the something class, and all of them are activated.
jquery ajax php wordpress
Adam Mo.
source share