i simply want to remove a message block by using functions.php. This is the action i wish to remove:
if( empty( $active_ids ) ){
add_action( 'sensei_loop_course_inside_before',
array( $this, 'active_no_course_message_output' ) );
}
so i figure i had to refer to the class before i could access it's function i wish to remove, so i did:
function remove_no_active_courses_message(){
//classname where the function i want to remove is:
//class Sensei_Shortcode_User_Courses implements Sensei_Shortcode_Interface
remove_action( 'sensei_loop_course_inside_before', array( 'Sensei_Shortcode_User_Courses', 'active_no_course_message_output' ) );
remove_action( 'sensei_loop_course_inside_before', array( $Sensei_Shortcode_User_Courses, 'active_no_course_message_output' ) );
}
add_action('sensei_loop_course_inside_before', 'remove_no_active_courses_message');
But neither of the 2 worked, any suggestions?
Edit: source class: https://github.com/Automattic/sensei/blob/master/includes/shortcodes/class-sensei-shortcode-user-courses.php
Edit 2 (note: when i try to global the class object, it var dumps null on this class so maybe the problem is i cant access it's global element? the woothemes sensei object works fine and i can print stuff from that. but not accessing the function via the class object instance) I tried some of the suggested answers:
function remove_no_active_courses_message(){
//classname where the function i want to remove is:
//class Sensei_Shortcode_User_Courses implements Sensei_Shortcode_Interface
global $Sensei_Shortcode_User_Courses; //DOESNT SEEM TO INSTANTIATE?
global $woothemes_sensei; //WORKS FINE AND CAN ACCES IT'S OBJECTS HERE
//var_dump($Sensei_Shortcode_User_Courses); //PRINTS NULL
//var_dump($woothemes_sensei); //PRINTS THE ENTIRE THINGY SUCCESFULLY
remove_action( 'sensei_loop_course_inside_before', array( $Sensei_Shortcode_User_Courses, 'active_no_course_message_output' ), 99 );
}
add_action('wp_footer', 'remove_no_active_courses_message');
Just asking, its there a way that this files is called after functions.php?
This is ugly but let´s tried,
Create a function that return and empty string:
function emptyString(){
return ' ';
}
Then add to the hook
add_action('sensei_loop_course_inside_before', 'emptyString', 11)
Let's do this and check if something happens