0
add_action( 'plugins_loaded', 'mytheme_remove_show_my_balance' );
function mytheme_remove_show_my_balance() {
  if ( !current_user_can( 'administrator' ) ) {
    remove_action( 'personal_options', array( $this, 'show_my_balance' ) );
  }
}

The above is what I've tried and the following two files in the plugin contain the action that I wish to remove or otherwise block or disable:

https://github.com/mycred/myCRED/blob/master/includes/mycred-admin.php

https://github.com/mycred/myCRED/blob/master/modules/mycred-module-management.php

2
  • Welcome to WPSE, perhaps helps it when you add global $your_class_name; inside the function to get access to the class object instance at all. And replacing $this also with $your_class_name?
    – Charles
    Commented Feb 10, 2020 at 19:07
  • Welcome to the community. When using remove_action() to remove a hooked method of an instance of a class ($this), you should get that instance first! See this: remove_action or remove_filter with external classes?
    – Yashar
    Commented Feb 10, 2020 at 23:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.