Titles disappears when updating widgets in admin
-
Hello,
When I update my widgets in the admin, I lost all my titles when I go back in the frontend. I have found that the problem comes from the file class-widget.php.
When you move or update widgets, the ajax function widgets-order is called and this add by default on all wysiwyg-widgets the value false on title attribute. On line 42, you check if the title attribute exists but not if it’s empty so when it’s false, it exists but it’s empty so the title is not shown.
To fix the problem, I have replaced isset by empty. This let the older version of the plugin working, but do not remove the title when it’s empty!
if( $show_title ) { // first check $instance['title'] so titles are not changed for people upgrading from an older version of the plugin // titles WILL change when they re-save their widget.. $title = ( !empty( $instance['title'] ) ) ? $instance['title'] : $post->post_title; $title = apply_filters( 'widget_title', $title ); echo $args['before_title'] . $title . $args['after_title']; }
santerref.
- The topic ‘Titles disappears when updating widgets in admin’ is closed to new replies.