Remove action that incudes external class


I’m attempting to achieve something similar to the following question, but I’m having difficulty attaining the desired result – Remove an action from an external Class

The WordPress theme Neve is adding markup to a page using the following function. I would like to remove this markup.

class Woocommerce {

private function edit_woocommerce_header() {
        add_action( 'neve_before_shop_loop_content', array( $this, 'add_header_bits' ), 0 );

public function add_header_bits() {
        if ( ! is_shop() && ! is_product() && ! is_product_category() && ! is_product_taxonomy() && ! is_product_tag() ) {

        echo '<div class="nv-bc-count-wrap">';
        do_action( 'neve_bc_count' );
        echo '</div>';

        if ( is_product() ) {

        echo '<div class="nv-woo-filters">';
        do_action( 'nv_woo_header_bits' );
        echo '</div>';


Please note, the above is a very condensed version of the code that the theme uses to add the markup. The specific file of the theme within which this code is implemented can be viewed here.

Generally this would be very easy to achieve using remove_action but the action includes a class, which has me stumped.

add_action( 'neve_before_shop_loop_content', array( $this, 'add_header_bits' ), 0 );

I’m not greatly familiar with classes. I’ve used the following function in a plugin to try and remove the action.

function remove_markup() {
    global $woocommerce;
    remove_action( 'neve_before_shop_loop_content', array( $woocommerce, 'add_header_bits' ), 0 );
add_action( 'init', 'remove_markup' );

This is not working however.

I’m using the following plugin to add functions to the website – My Custom Functions

Am I doing something wrong here? I’ve called my action using the init hook, but I’m not sure if that’s the right hook.

Any help would be appreciated.

Connor 1 month 0 Answers 12 views 0

Leave an answer