after_switch_theme

after_switch_theme

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7.2

do_action('after_switch_theme') is found 2 times:

  • /wp-includes/theme.php line 3504
    3500
    3501
    3502
    3503
    3504
    3505
    3506
    3507
    3508
    3509
    3510
         *
         * @param string   $old_name  Old theme name.
         * @param WP_Theme $old_theme WP_Theme instance of the old theme.
         */
        do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );
    } else {
        /** This action is documented in wp-includes/theme.php */
        do_action( 'after_switch_theme', $stylesheet, $old_theme );
    }
     
    flush_rewrite_rules();
  • /wp-includes/theme.php line 3507
    3503
    3504
    3505
    3506
    3507
    3508
    3509
    3510
    3511
    3512
    3513
             */
            do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );
        } else {
            /** This action is documented in wp-includes/theme.php */
            do_action( 'after_switch_theme', $stylesheet, $old_theme );
        }
     
        flush_rewrite_rules();
     
        update_option( 'theme_switched', false );
    }

See this hook used in plugins: