I am trying to call dynamic_sidebar
from a plugin page. Whenever I do so, it returns a white page! Any idea why?
What I am trying to do is to save the total sidebar output in a transient. I can get the sidebar output in a variable from the theme files, using this codes:
ob_start();
dynamic_sidebar('name');
$sidebar= ob_get_contents();
ob_end_clean();
I can get the data in $sidebar
and save it in a transient. But whenever I use this code from a plugin, the plugin admin page returns white screen. It happens whenever I call dynamic_sidebar
in my plugin codes, doesn't matter what's before or after.
Does anyone know why? Or any solution please?