• Resolved s0what

    (@s0what)


    Hi!

    I need to modify one theme which isn’t built very smart.
    I need to override (remove) this action using child theme
    add_action( 'after_setup_theme' , 'setup_theme' );

    I tried to do following, but it doesn’t work:

    add_action('init','remove_setup_theme');
        function remove_setup_theme(){
            $status = remove_action( 'after_setup_theme' , 'setup_theme' );
            if ($status) {
                echo(' setup_theme removed');
            } else wp_die(' setup_theme not removed');
        }

    And it always dies ??
    Please help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    Try this code

    add_action('after_setup_theme','remove_setup_theme');
    function remove_setup_theme(){
        $status = remove_action( 'after_setup_theme' , 'setup_theme', 1 );
        if ($status) {
            echo(' setup_theme removed');
        } else {
            wp_die(' setup_theme not removed');
        }
    }

    because init called after after_setup_theme so parent theme action called before your remove action.

    Thread Starter s0what

    (@s0what)

    Thanks! It worked, but I had to add priority to add_action not remove_action ??

    Same thing both are same hooks not an issue ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Run child function after parent theme function if parent using after_setup_theme’ is closed to new replies.