Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
Have you read this? –  toscho Apr 18 '13 at 11:26
    
I was hoping it maybe a bit simpler than that example - from the codex it looks like it's just two lines. I was using the example here also: wordpress.stackexchange.com/questions/75130/… –  Steve Apr 18 '13 at 11:57
1  
Add a link to the code of that plugin to your question. There might be an easier way. –  toscho Apr 18 '13 at 11:59
    
Was the plugin initialized as a global variable? –  helgatheviking Apr 18 '13 at 12:08
add comment

2 Answers

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.

share|improve this answer
add comment

Thanks for all comments and answers - I just solved this:

function remove_eazyest_gallery() {
remove_action('eazyest_gallery_thumbnails',     'ezg_thumbnails', 5);
}
add_action( 'eazyest_gallery_ready', 'remove_eazyest_gallery', 1 );
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.