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>";
          endif;
        });

        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:

add_action('stachethemes_ec_add_event_tab_content','custom_stachethemes_tab_content');
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


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: