switch_to_blog() + do_action('generate_footer') not working in multisite
I have a multisite installation and try to output the main site's header footer on all subsites. In header it's working fine:
switch_to_blog( '1' );
do_action( 'generate_header' );
restore_current_blog();
But in footer the switch itself is working, as it outputs the main site's name, but it doesn't show the footer - it outputs only empty widget-areas, neither the ones from the main-site nor the ones from the subsite.
switch_to_blog( '1' );
echo get_bloginfo( 'name' );
do_action( 'generate_footer' );
restore_current_blog();
It's not a theme problem, same result on blank storefront and generatepress.
Any ideas?
Topic switch-to-blog footer php Wordpress
Category Web