Wordpress Widgets Disappear in Administration

My company pays for optimizing the Wordpress site, I'm trying to make some changes that should appear in the widget section (forms, reviews, etc.).

With their custom theme, in the widget section, on the right side, where all the sidebars are listed, if I expand them, they are empty. If I drag the text widget and add β€œTest” and then β€œSave”, it will be displayed on the front, but as soon as the widget page refreshes, if I open the sidebar again, it will be empty. Widgets appear below inactive widgets, but not to the right, where I can edit them.

I tried this using the default theme and the widgets display as expected. I don’t know enough about Wordpress to find out where to look, to eliminate widgets that disappear from the admin sidebar section.

+6
source share
5 answers

this decision.

we just need to change the sidebar id. id should be only in small letters. Caps are not allowed. if we use the cover identifier on any side panel, the problem arises on the same side panel or on any other side panel to automatically remove widgets when updating.

I just mention an example below.

This is the wrong template -

register_sidebar( array( 'name' => __( 'Main Sidebar', ), 'id' => 'Sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => "</aside>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); 

This is the correct template. Please note that I just changed the identifier to correctly configure the saving of widgets.

 register_sidebar( array( 'name' => __( 'Main Sidebar', ), 'id' => 'Sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => "</aside>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); 

Secondaly, wordpress never mentioned that the identifier should be in small letters, this is another wordpress error. But in such large cms, these things are sure to happen.

+8
source

I have the same problem after I changed the identifiers of the sidebars (in register_sidebar)

Sidebars are displayed in the admin part, I can change their contents, which is reflected in the interface, but the refreshing admin page displays empty sidebars (and saving reflects empty sidebars in the interface)

I could solve the problem by deleting the sidebars (deleting calls to register_sidebar), updating the admin page, which unexpectedly showed all the widgets in the list of inactive widgets (many of them, since I put new widgets many times before solving the problem), and Reactivate register_sidebar calls.

+2
source

I had the same problem and solved it by changing the widget name to lowercase according to the best solution here. I experienced this problem on 3.6

+2
source

I had the same problem. I had the wrong quotation mark. Try going from> "<to> '<

FROM

  'id'=> "sidebar-1", 

TO:

 'id'=> 'sidebar-1', 
+1
source

I had the same problem, and I did it for a couple of days, it all came from identifiers - I change them without gaps or spaces, and it works magically! Finally! Good luck

0
source

Source: https://habr.com/ru/post/887650/


All Articles