I am currently developing a WooCommerce store, based on Astra with a lot of custom coding. I have noticed two or three times that my widgets were missing all of a sudden. In fact, they just got moved to other widget sections.

To be more specific, I have 4-column footer with 4 widgets, I have 1 widget in blog sidebar, and 4 widgets in WooCommerce sidebar.

When they got moved, they always ended up in the same widget areas. All sidebar widgets (including WC ones) were in the default blog sidebar, and 2 out of 4 footer widgets got moved to the bottom bar areas.

I don't use any plugin that does anything with widgets, and all I do with widgets in my code, is this:

1.) Allowing shortcodes in HTML/text widgets.

add_filter( 'widget_text', 'do_shortcode' );

2.) Register my custom widget (regular way, with some irrelevant markup).

function hstngr_register_widget() {
    register_widget( 'brands_widget' );

add_action( 'widgets_init', 'hstngr_register_widget' );
class brands_widget extends WP_Widget {
    function __construct() {
            __('Brands widget', ' brands_widget_domain'),
            array( 'description' => __( 'Display existing brands', 'brands_widget_domain' ), )
    public function widget( $args, $instance ) {
        if ( isset( $instance[ 'title' ] ) ) {
            $title = apply_filters('widget_title', $instance['title']);
        echo $args['before_widget'];
        if ( ! empty( $title ) )
            echo $args['before_title'] . $title . $args['after_title'];

        // Output
        $brands = get_terms( array(
            'taxonomy' => 'vyrobca',
            'hide_empty' => 0

        echo '<ul class="product-categories sidebar-brands">';
        foreach($brands as $brand) {
            echo '<li class="cat-item">';
            echo '<a href="' . get_term_link($brand->term_id) . '" title="' . $brand->name . '">';
            echo '<img src="' . get_field('icon', 'vyrobca_' . $brand->term_id) . '" alt="' . $brand->name . '">';
            echo '</a>';
            echo '</li>';
        echo '</ul>';

        echo $args['after_widget'];
    public function form( $instance ) {
        if ( isset( $instance[ 'title' ] ) )
            $title = $instance[ 'title' ];
            $title = __( 'Brands widget', 'brands_widget_domain' );
            <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
            <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
    public function update( $new_instance, $old_instance ) {
        $instance = array();
        $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
        return $instance;

The widgets get moved randomly, I don't see any pattern. I do changes in the code, in the admin dashboard, install new plugins, everything is fine. Then, randomly, widgets are gone.

1 Answer 1


If those widgets are plugins then if one of them is conflicting it can cause that issue. One way to test is to deactivate all plugins except one, and see if it happens. Then activate another plugin and test again until you find out which plugin is causing the issue.

  • No, those are regular native WP/WC widgets (filter by price, product categories, rating...), HTML widgets with just a basic markup in the footer. Only one widget is custom, defined in functions.php, as mentioned in the original question. Dec 13, 2019 at 7:36
  • Product is not a native WP widget. It's part of WooCommerce. If only one widget is from a plugin it can cause that issue. I still recommend deactivating all plugins and test one by one until you find the culprit.
    – MistaPrime
    Dec 13, 2019 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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