Remove an action hook within a Class

I’ve got the following class declaration:

class stachethemes_ec_main extends stachethemesevent_calendarstachethemes_main_template {

and the following function with the action hooks:

public function add_event_tab($slug, $title, $icon, $content = "", $file = false) {

        add_action('stachethemes_ec_add_event_tab', function() use($slug, $title, $icon) {
          if ($slug != "woocommerce") :
            echo "<li data-tab='stec-layout-event-inner-{$slug}'><i class='{$icon}'></i><p>{$title}</p></li>";

        add_action('stachethemes_ec_add_event_tab_content', function() use($slug, $content, $file) {

I want to remove the stachethemes_ec_add_event_tab_content action hook with the following remove_action:

function custom_stachethemes_tab_content(){
  remove_action('stachethemes_ec_add_event_tab_content',array('stachethemes_ec_main', 'add_event_tab'));

Am I doing anything wrong, because it’s not working?

Read more here: Remove an action hook within a Class

Leave a Reply

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