Hi @yordansoares,
Please try wrapping above “remove_action” function inside a hook. Like:
add_action( 'wp_head', 'remove_ur_action' );
function remove_ur_action(){
remove_action( 'admin_notices', array( 'UR_Admin_User_List_Manager', 'pending_users_notices' ) );
}
Regards!
Hi again @rumesh38,
Isn’t wp_head a themes action? I mean, the notices fires on dashboard action ‘admin_notices’, not in frontend. Here is a capture of the message ‘pending_users_notices’ method shows:

I already tried with:
// Hook 'admin_notices' with priority 20:
add_action( 'admin_notices', 'remove_ur_action', 20 );
// Hook 'admin_notices' with priority 5:
add_action( 'admin_notices', 'remove_ur_action', 5 );
// Hook 'admin_notices' with priority 10 (default):
add_action( 'admin_notices', 'remove_ur_action' );
// Hook 'init' with priority 20:
add_action( 'init', 'remove_ur_action', 20 );
// Hook 'init' with priority 5:
add_action( 'init', 'remove_ur_action', 5 );
// Hook 'init' with priority 10 (default):
add_action( 'init', 'remove_ur_action' );
function remove_ur_action(){
remove_action( 'admin_notices', array( 'UR_Admin_User_List_Manager', 'pending_users_notices' ) );
}
But still don’t works. In WordPress Developer Resources says “If an action has been added from within a class, for example by a plugin, removing it will require accessing the class variable.” and shows this example code:
global $my_class;
remove_action( 'the_content', array( $my_class, 'class_filter_function' ) );
Does User Registration use a global variable for the class «UR_Admin_User_List_Manager»?
Hi @yordansoares,
There is no Global variable for “UR_Admin_User_List_Manager” class in our plugin. Neither the function “pending_users_notices” where you would have used the above code to remove action. We can give you a zip file of our plugin with a temporary solution. Please contact us through our contact form.
https://wpeverest.com/contact/
Regards!
Thanks for offer a custom fix. I already fixed it commenting the line :33. But this solution did not satisfy me, so I searched for a better way.
The remove_action core function work very limited with methods from a class. The unique way to remove a method usint it is when the class was instatiate in a global variable. It isn’t the case of The UR_Admin_User_List_Manager class I need to access.
Browsing the Internet, I found this link where there is a custom function that extends the WP Filter API:
function remove_class_action($tag, $class = '', $method, $priority = null) : bool {
global $wp_filter;
if (isset($wp_filter[$tag])) {
$len = strlen($method);
foreach($wp_filter[$tag] as $_priority => $actions) {
if ($actions) {
foreach($actions as $function_key => $data) {
if ($data) {
if (substr($function_key, -$len) == $method) {
if ($class !== '') {
$_class = '';
if (is_string($data['function'][0])) {
$_class = $data['function'][0];
}
elseif (is_object($data['function'][0])) {
$_class = get_class($data['function'][0]);
}
else {
return false;
}
if ($_class !== '' && $_class == $class) {
if (is_numeric($priority)) {
if ($_priority == $priority) {
//if (isset( $wp_filter->callbacks[$_priority][$function_key])) {}
return $wp_filter[$tag]->remove_filter($tag, $function_key, $_priority);
}
}
else {
return $wp_filter[$tag]->remove_filter($tag, $function_key, $_priority);
}
}
}
else {
if (is_numeric($priority)) {
if ($_priority == $priority) {
return $wp_filter[$tag]->remove_filter($tag, $function_key, $_priority);
}
}
else {
return $wp_filter[$tag]->remove_filter($tag, $function_key, $_priority);
}
}
}
}
}
}
}
}
return false;
}
This function allows you to disable any action or filter inside a class not instantiated. I used this code to fix the issue without worry about overriden by updates:
add_action('plugins_loaded', function() {
remove_class_action('admin_notices', 'UR_Admin_User_List_Manager', 'pending_users_notices');
});
Thanks again for your help 😉