I'm trying to remove an action that a plugin registers in a separate functions.php file, but the syntax is stumping me. The plugin (I can't copy/paste - commercial plugin) infers to the add_action like so:
class Plugin_Class{
function add_actions(){
add_action('tag', array(&$this, 'function_to_remove'), 10);
}
function_to_remove(){
global $wp;
// Code here
}
}
I'm mostly confused with &$this
. I know that this refers to the instance of the class, but based off my research it should be removed like so:
Need help with remove_action()
I just don't know how to come up with the syntax for my situation. Why define the global variable? Would I need to do that in my case? I'm assuming the widget array comes from WP core code, but I'm confused on how I need to implement this in my case, which seems to be much simpler. Sorry if this stuff is remedial.
Thanks for any help in advance.
The &$this creates a reference instead of a copy. That way when you access that variable later, you really access this object and not a copy.
http://www.php.net/manual/en/language.references.whatdo.php
See the paragraph about array "not exactly assigning by reference, but equivalent."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With