Widget items disappearing

if ( function_exists('register_sidebar') )
    register_sidebar(array(
        "name" => "Top Widget Area",
        "id" => "topWidgetArea-$i",
    ));

I just create a new sidebar with this.
I’m displaying this sidebar in my header.php like this:

<?php dynamic_sidebar( "Top Widget Area" ); ?> 

It’s displaying no problem and I can put every widget to my sidebar in wp-admin’s Appearance → Widgets page. When I refresh this widgets page, all the widgets (which are in the Top Widget Area) are disappearing. I’ll explain it with a video. Please check: http://screenr.com/szG8

Related posts

Leave a Reply

4 comments

  1. Changing widget’s ID from topWidgetArea to top-widget-area solved my problem. Widget ID must have hypen. I tried a lots of variations for ID (like testtesttest, asdasdasd, widgetareaaa) . I’m not sure, why .

  2. You are not allowed capitals that is why it doesn’t work.

    Use a name like this-dynamic-sidebar or this_dynamic_sidebar. It should be the same name used when you registered the sidebar.

  3. It is the variable $i that is the issue, causing probably a php error because it is not defined.

    Just had the same issue. Removing the id prams solved the issue.