Set theme mod after switch theme
-
After switch theme, the custom logo lost.
For solve this problem, i try insert a theme mod on switch_theme action, but no success.After switch a theme, is possible insert a theme mod for new switched theme?
My function:
function rock_theme_switch_logo() { if ( has_custom_logo() ) { $custom_logo_id = get_theme_mod( 'custom_logo' ); set_theme_mod( 'custom_logo', $custom_logo_id ); } }
Tried with both actions:
add_action( 'after_switch_theme', 'rock_theme_switch_logo' );
add_action( 'switch_theme', 'rock_theme_switch_logo' );
Note: I’m puting this code on my theme functions.php
Any Idea?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Set theme mod after switch theme’ is closed to new replies.