Why is registering a sidebar for each page causing my sidebars to reset?
-
I have the following code in my functions.php
if ( function_exists('register_sidebars') ){ $pages=get_pages(); foreach($pages as $page){ register_sidebar(array('name'=>$page->post_title, 'sort_column'=>'ID','sort_order'=>'ASC', 'id'=>$page->ID)); } }
It works beautifully to give me a sidebar for each page. The problem is that the sidebar contest are constantly being reset. Every time I go back to my widgets page, the sidebars are all blank. I can usually still see the contents on the actual site, unless I update something in a different sidebar. If I take out the loop and just use register_sidebar to register a single sidebar, everything seems to work fine. Any ideas why?
- The topic ‘Why is registering a sidebar for each page causing my sidebars to reset?’ is closed to new replies.