There is a plugin that is loading ajax actions like so:
add_action( 'wp_ajax_nopriv_func_name', array( &$this, 'func_name' ) ); add_action( 'wp_ajax_get_func_name', array( &$this, 'func_name' ) );
I want to remove them in my theme so I am doing:
But they are still there. I am definitely doing this after they have been added. I brought $wp_filter into scope and saw they were definitely set before my code and unset after.
It looks though like wordpress when you add ajax actions works a little differently. I think the actual action is stored somewhere else and I am just removing an alias to it as when I look inside the $wp_filter array the function name is like
I am not sure where it is referencing or what the procedure is for removing it.
Can anyone shed some light on this for me?
I think the numbers are because the class object is being passed, I guess its a hash of the class.
This appears to be a bug/inconsistency. I did the following test:
add_action('wp_ajax_nopriv_ajax_test', array(&$this, 'ajax_test')); add_action('wp_ajax_ajax_test', array(&$this, 'ajax_test')); remove_all_actions('wp_ajax_nopriv_ajax_test'); remove_all_actions('wp_ajax_ajax_test');
Does anyone know where this is being stored?
I found the code responsible in admin-ajax.php
do_action( 'wp_ajax_' . $_REQUEST['action'] );
The really weird thing I can't get my head around is that the ajax request returns before this code is hit. So it seems this code is just for doing associated actions and not returning the ajax request.