• Pamela

    (@infoknutsford-softwarecouk)


    I am trying to remove an action but it isn’t being removed

    This is what I have in functions.php

    
    add_action( 'sensei_single_quiz_questions_after', 'remove_action_buttons', 10, 0 );
    
    function remove_action_buttons() {
    		
        	remove_action( 'sensei_single_quiz_questions_after', array( 'Sensei_Quiz', 'action_buttons' ), 10, 0  );
    	
    }
    	
    add_action( 'sensei_single_quiz_questions_after', 'new_action_buttons' );
    
    function new_action_buttons() {
    
    

    The original add action is

    add_action( ‘sensei_single_quiz_questions_after’, array( ‘Sensei_Quiz’, ‘action_buttons’ ), 10, 0 );

    It is definitely going into the function that calls the remove but the buttons are still there on the page. It calls the replacement ok and adds those buttons. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    I think to remove an action with remove_action() it needs to be called with the same parameters (except the priority parameter)

    
    remove_action( 'sensei_single_quiz_questions_after', 'new_action_buttons' );
    Thread Starter Pamela

    (@infoknutsford-softwarecouk)

    Nope that doesn’t work

    Thread Starter Pamela

    (@infoknutsford-softwarecouk)

    I presumed you meant

    remove_action( ‘sensei_single_quiz_questions_after’, ‘action_buttons’ );

    by the way.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘remove action not working’ is closed to new replies.