need help removing action from plugin file

前端 未结 6 1635
醉话见心
醉话见心 2021-01-22 03:10

Hello I am trying to remove an action from a wordpress plugin file. The plugin is called Woocommerce Points and Rewards. I have found the action I want to remove in one of the

6条回答
  •  渐次进展
    2021-01-22 03:51

    In case anyone else is wondering, I just accomplished removing the action in this plugin in the following way.

    I wanted to remove the action defined in class-wc-points-rewards.php on line 34:

    add_action( 'woocommerce_single_product_summary', array( $this, 'render_product_message' ) );
    

    To do that, I looked at woocommerce-points-and-rewards.php. On line 46 it shows:

    $GLOBALS['wc_points_rewards'] = new WC_Points_Rewards();
    

    And in the same file for the definition of the WC_Points_Rewards class, on line 249-250 it shows:

    require( 'includes/class-wc-points-rewards-product.php' );
    $this->product = new WC_Points_Rewards_Product();
    

    With that information, I was able to remove the action:

    remove_action( 'woocommerce_single_product_summary', array( $GLOBALS['wc_points_rewards']->product, 'render_product_message' ) );
    

提交回复
热议问题