I'm working on a custom widget. When on the widgets.php page in the admin area (so not the front-end) of the WP site I want to dynamically get the sidebarname of the current sidebar inside my widget. So when my widget is dragged into a sidebar you can see a little heading that says: ' This is MyWidget in the sidebarname ' .

The form() function from the widgetAPI only recieves one parameter: $instance. I can't see how it's possible to recieve the sidebarname from this. On the frontend you can easily see but here I can only get a list of all sidebars that exist.

Does someone know if it's possible and how to achieve this?

Thanks in advance!

edit: I found this question from someone who wants the same: How to determine the current widget's parent container (sidebar widget id)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.