Created
April 18, 2019 21:23
-
-
Save mahfelwp/995afa81f81247e19d6a0e8265b83230 to your computer and use it in GitHub Desktop.
Access to Private Property of Class And Remove Action From Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Access to Private Property of Class And Remove Action From Class | |
* add_action pirority is very important => 9 | |
*/ | |
function remove_action_from_class(){ | |
global $Youzer; | |
$myClassReflection = new ReflectionClass( get_class( $Youzer ) ); | |
$secret = $myClassReflection->getProperty('instance'); | |
$secret->setAccessible(true); | |
remove_action( 'bp_init', array( $secret->getValue( $Youzer )->profile, 'init' ) ); | |
} | |
add_action( 'bp_init', 'remove_action_from_class', 9 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment