after_switch_theme
do_action( ‘after_switch_theme’, string $old_name , WP_Theme $old_theme )
动作钩子::如果旧主题仍然存在,则在主题切换后的第一次WP加载时激发。
Action Hook: Fires on the first WP load after a theme switch if the old theme still exists.
说明(Description)
如果旧主题存在或不存在,此操作将多次激发,并且参数根据上下文而不同。如果旧主题丢失,参数将是旧主题的slug。
参数(Parameters)
参数 | 类型 | 说明 |
---|---|---|
$old_name | (string) | 旧主题名称。 |
$old_theme | (WP_Theme) | WP_旧主题的主题实例。 |
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
3.3.0 | wp-includes/theme.php:2974 | 1 | 0 |
笔记(Notes)
激活主题时更新默认的中等图像大小。
after_switch_theme 为WP2原创文章,链接:https://www.wp2.cn/hook/after_switch_theme/