I am using a plugin that has this line of code to add an action from the Eazyest_Frontend class:

add_action( 'eazyest_gallery_thumbnails', 'ezg_thumbnails',5);

I want to remove that and do something a bit different without editing the plugin. I thought this added to my functions.php file might work:

global $eazyest_frontend;    
remove_action( 'eazyest_gallery_thumbnails', array($eazyest_frontend,'ezg_thumbnails'), 1, 1 );

I have maybe tried a hundred variations where I altered the priority etc but nothing works yet.

If I comment out the original add action line in the plugin, it does have the effect I am seeking so I seem to have identified the correct action.

I’m new to removing actions, how is it done?

3 s
3

Maybe I got you wrong, but why don’t you just put the following line in your functions.php:

remove_action('eazyest_gallery_thumbnails', 'ezg_thumbnails');

If you have a class function hooked to an action, you can use the class name instead of the class object:

remove_action(
    'eazyest_gallery_thumbnails',
    array('EazyestFrontendClassName', 'ezg_thumbnails')
);

Right now, I don’t see why this wouldn’t be working. Just tried with an action from one of my plugins.

Leave a Reply

Your email address will not be published. Required fields are marked *