0

Every time when I save my widgets and navigate away from the page, my widgets are gone. The sidebar is completely emptied and no change will be saved.

I don't get any errors in the console or PHP log.

If I copy and save the widgets directly in the database under widgets_text, they will be shown but still I can't add or remove anything to the sidebar.

This only happens to my right sidebar, my left sidebar works fine while they are both registered in the same way. This is how I register my sidebars:

function my_widgets_init() {
    register_sidebar( array (
        'name'          => 'Left sidebar',
        'id'            => 'left-sidebar',
        'description'   => 'Widgets dragged here will appear in the left sidebar.',
        'before_widget' => '',
        'after_widget'  => '',
        'before_title'  => '',
        'after_title'   => ''
    ) );
    register_sidebar( array (
        'name'          => 'Right Sidebar',
        'id'            => 'right-sidebar',
        'description'   => 'Widgets placed here will appear on the right side of the website.',
        'before_widget' => '',
        'after_widget'  => '',
        'before_title'  => '',
        'after_title'   => ''
    ) );
}

How can I fix this?

1
  • 1
    There's a kludgey kludge involving changing to accessibility mode and saving, then switching back, but that doesn't explain why it solves it or what the root problem was to begin with
    – Tom J Nowell
    Jul 13 '17 at 11:34
0

Make sure you have called a right hook to register your widgets.

You may call your widget through dynamic_sidebar function. Please see full description.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.