Support » Fixing WordPress » Populate sidebar with widgets in php code
5 years, 9 months ago
Hey guys. I’ve hit an epic roadblock and I’m beginning to go crazy.
Is there a way to populate a sidebar with available widgets. So for example, say if I create a new custom sidebar and I want to auto populate it with a set of widgets (ie. text, tag_cloud).
I’ve been trying to trace the steps by looking through the admin-ajax.php and rewriting the code in a plugin. Basically mimicing the ajax calls that are done from the widgets page.
I hit a wall when I’m trying to access the global variables like:
Problem is they’re all empty! However when using ajax they are set. I’ve tried including all files and including all actions that the admin-ajax runs and with no success.
Any help or direction on how to do this would help. Thanks!