0Day Forums
Wordpress widgets are disappearing in admin area - Printable Version

+- 0Day Forums (https://zeroday.vip)
+-- Forum: Coding (https://zeroday.vip/Forum-Coding)
+--- Forum: CMS (https://zeroday.vip/Forum-CMS)
+---- Forum: WordPress (https://zeroday.vip/Forum-WordPress)
+---- Thread: Wordpress widgets are disappearing in admin area (/Thread-Wordpress-widgets-are-disappearing-in-admin-area)



Wordpress widgets are disappearing in admin area - dudek628 - 07-27-2023

My company is being paid to optimize a Wordpress site, I am trying to make some modifications that should be showing up in the widgets section (forms, testimonials etc).

With their custom theme, in the widgets section, on the right hand side where it lists all the sidebars, if I expand any, they are empty. If I drag a text widget over and add "Test", and then Save, it will show up on the front end, but once the widgets page refreshes, if I expand the sidebar again, it shows empty. The widgets show up under inactive widgets but not to the right where I should be able to edit them.

I have tried this using the default theme and the widgets show up as expected. I don't know enough about Wordpress to know where to look to fix the widgets disappearing from the admin sidebar section.


RE: Wordpress widgets are disappearing in admin area - foveolets737167 - 07-27-2023

I got the same issue after I changed the sidebars ids (in register_sidebar)

The sidebars show in admin part, I can change their content, which is reflected in front end, but refreshing admin page displays empty sidebars (and saving reflects empty sidebars in front end)

I could solve it by removing the sidebars (remove the calls to register_sidebar), updating admin page, which suddenly showed all the widgets in inactive widgets list (a lot of them since I put new widgets many times before solving the issue), and re-activating the calls to register_sidebar.




RE: Wordpress widgets are disappearing in admin area - accordionszvzrbcnxtq - 07-27-2023

this is the solution.

we just need to change the id of sidebar. id should be only in small letters. Caps are not allowed. if we use cap id in any of the sidebar, the problem occurs in the same sidebar or any other sidebar of automatically removing widgets on refresh.

I am just mentioning an example below.

This is the Wrong Pattern -

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 right pattern. Note i just changed the id to correctly configure the widgets saving.

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 has not mentioned anywhere, that id should be in small letters, this is another bug by wordpress. But in such big cms, these things are bound to happen.



RE: Wordpress widgets are disappearing in admin area - rewound75216 - 07-27-2023

I had the same issue and solved it by modifying the name of the widget to lower case as per the best solution here. i experienced this issue on 3.6


RE: Wordpress widgets are disappearing in admin area - briar495878 - 07-27-2023

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

FROM:

'id'=> "sidebar-1",

TO:

'id'=> 'sidebar-1',


RE: Wordpress widgets are disappearing in admin area - jaxsonlaqnokljw - 07-27-2023

I've had the same issue and have dealt with it a couple of days, it all came from the ids - I changes them to no caps and no spaces and it magically worked ! Finally! Good luck!


RE: Wordpress widgets are disappearing in admin area - ortega984463 - 07-27-2023

I had the same problem and solved uninstalling the plugin Google Analyticator. Check if you have that plugin installed or another one of google analytics.


RE: Wordpress widgets are disappearing in admin area - Projelenesxyipy - 07-27-2023

I had a similar problem but mine was due to the id being a number. I had selected 404 and the widgets disappeared on refresh. I renamed the id to fourohfour and it resolved the problem.