Is there a way to get only the sidebars used on a particular page?


global $wp_registered_sidebars;
$widget_map = wp_get_sidebars_widgets();

Can get me all of the sidebars, but I'm interested in getting the sidebars only for a particular page. Something sounding like get_sidebars_by_page_id()

  • I'm confused, do you mean get specific widget area from a page? Sometime ago, I created a theme where every page had its own widget area dynamically, so "about page" had a "About" widget area etc. (Please do not use wp_get_sidebars_widgets is deprecated.)
    – Diana
    Sep 24, 2012 at 19:38
  • The function wp_get_sidebars_widgets isn't deprecated, the codex is referring to its parameter that is deprecated. I mean getting the sidebar IDs of a page if I only know the page object. Sep 24, 2012 at 20:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.