Remove All Pro Widgets

Home Forums Calendar Products Events Calendar PRO Remove All Pro Widgets

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #972295
    gazelle
    Participant

    Before 3.10 Update I was unregistering all of the Event Pro Widget with this:

      if(class_exists('TribeEventsPro'))
                {
                    remove_action('widgets_init', array(TribeEventsPro::instance(), 'pro_widgets_init'), 100);
                }
    

    But now that no longer works with the new update. I have tried several things considering TribeEventsPro has been moved to Tribe__Events__Pro__Main but have had no luck.

    A simple rename does not work:

      if(class_exists('TribeEventsPro'))
                {
                    remove_action('widgets_init', array(Tribe__Events__Pro__Main::instance(), 'pro_widgets_init'), 100);
                }
    

    Please advise on how to unregister all event widgets, thanks!

    #972498
    Barry
    Member

    Hi there @gazelle,

    You’ve updated on class name but not the other (in your class_exists() check) so that could be worth updating.

    Can you confirm where this code is situated and what if any hook it runs on?

    #972633
    gazelle
    Participant

    Sorry, I had it correct in my code but just copied it from my previous comment incorrectly. Got it to work by matching the priority on the remove action exactly as how tribe is adding it (100)

    
    add_action('widgets_init', array('theEventsCalendarYcCleanup', 'removeTribeEventsProWidgets'));
    
        class theEventsCalendarYcCleanup
        {
    
            static public function removeTribeEventsProWidgets()
            {
                if(class_exists('Tribe__Events__Pro__Main'))
                {
                    remove_action('widgets_init', array(Tribe__Events__Pro__Main::instance(), 'pro_widgets_init'), 100);
                }
            }
        }
    

    I have more functions within my class “theEventsCalendarYcCleanup” but only posted the relevant function.

    Thanks!

    #972635
    Barry
    Member

    Glad you’re all sorted 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Remove All Pro Widgets’ is closed to new replies.