lundi 5 octobre 2015

Remove and add actions in Wordpress using functions.php

I have edited some plugin files in wordpress but this is bad form - it stand up to updates. I'd like to make the changes using functions.php but I can't get it to work correctly.

The basics are that I want to remove the following actions:

add_action( 'woocommerce_before_my_account', array( $this, 'my_account_memberships' ) );

add_action( 'woocommerce_before_my_account', __CLASS__ . '::get_my_subscriptions_template' );

And in their place add the actions:

add_action( 'woocommerce_add_subscriptions_to_my_accoun', array( $this, 'my_account_memberships' ) );

add_action( 'woocommerce_add_subscriptions_to_my_account', __CLASS__ . '::get_my_subscriptions_template' );

I have tried adding the following (for both sets) to my functions.php but to no avail...

remove_action ( 'woocommerce_before_my_account', __CLASS__ . '::get_my_subscriptions_template' );

add_action( 'woocommerce_add_subscriptions_to_my_account', __CLASS__ . '::get_my_subscriptions_template' );

What am I doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire