this is likely a bit of a unique problem that I've been struggling with for the past few days. I have a WordPress multisite setup. I have a plugin activated on my root site that IS NOT activated on any subsite. due to conflicts, I cannot activate the plugin on any subsites. The plugin displays values via shortcodes. I am trying to write a function that gets the output value from the shortcode and stores it in a variable so that I can insert that value into a subsite using my own shortcode. I am using the switch_to_blog() function. The result of my code below ends up being [plugin-shortcode-on-root-site] wherever I use my custom shortcode on a subsite rather than being the value that [plugin-shortcode-on-root-site] should output.
I'm hoping this all makes sense. Any help would be greatly appreciated! Thanks!
function return_shorcode_output () {
switch_to_blog(1);
$output = do_shortcode('[plugin-shortcode-on-root-site]');
restore_current_blog();
return $output;
}
add_shortcode( 'Shortcode_On_Subsite', 'return_shortcode_output' );