[wp-hackers] Problem with admin AJAX not executing plugin code

Dion Hulse (dd32) wordpress at dd32.id.au
Mon Apr 4 15:27:16 UTC 2011

It sounds like you might need to re-adjust what hooks you're using for what

admin_menu should only be used for things like registering admin menu's (as
thats what the hook is for) admin_init should be used for processing things
for all admin requests, load-$pagenow hooks should be used for page-specific
processing, etc..

But you might also want to look into the DOING_AJAX constants which are set
for ajax requests

On 5 April 2011 01:24, Philip Walton <philip at philipwalton.com> wrote:

> On 4/4/11 8:02 AM, Dion Hulse (dd32) wrote:
>> Ajax requests do not triger admin_menu, therefore I'm guessing your action
>> is never hooked. perhaps you should try admin_init instead?
> Dion, thanks for this bit of info! (Sorry, unrelated to this thread) I'm
> writing a plugin that keeps getting screwed up because my AJAX requests are
> calling all the same plugin logic that my main page requests are calling.
> Do you recommend putting plugin logic that you don't want AJAX requests to
> call in the 'admin_menu' hook, or is there a better place?
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list