remove_action for a function within a class (1 post)

  1. blogjunkie
    Posted 3 years ago #

    Hi! PHP OOP newbie here. I have a class like so:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    class example {
    	public function __construct() {
    		add_action( 'woocommerce_before_my_account', array(&$this, 'my_account') );
    	function my_account() {

    I want to reposition the output of my_account() by hooking it to the woocommerce_after_my_account hook. Usually I would do this by simply

    remove_action( 'woocommerce_before_my_account', 'old_function' );
    add_action( 'woocommerce_after_my_account', 'new_function' );

    But in this case I'm stuck because the function is within the class. Any help appreciated please!

Topic Closed

This topic has been closed to new replies.

About this Topic