Make WordPress Core


Ignore:
Timestamp:
02/07/2016 08:25:28 AM (9 years ago)
Author:
DrewAPicture
Message:

Themes: Pass information about the old theme in the form of a WP_Theme object when the switch_theme action is fired.

Props MikeHansenMe.
See #22401.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r35976 r36502  
    740740
    741741    update_option( 'theme_switched', $old_theme->get_stylesheet() );
     742
    742743    /**
    743744     * Fires after the theme is switched.
    744745     *
    745746     * @since 1.5.0
     747     * @since 4.5.0 Introduced the `$old_theme` parameter.
    746748     *
    747749     * @param string   $new_name  Name of the new theme.
    748750     * @param WP_Theme $new_theme WP_Theme instance of the new theme.
     751     * @param WP_Theme $old_theme WP_Theme instance of the old theme.
    749752     */
    750     do_action( 'switch_theme', $new_name, $new_theme );
     753    do_action( 'switch_theme', $new_name, $new_theme, $old_theme );
    751754}
    752755
Note: See TracChangeset for help on using the changeset viewer.