PHP notice: Undefined index: before_widget
-
I am using Orbit Fox combined with Elementor in my main page, using the woocommerce best products plugin to show my products, but sometimes when refreshing the page I am having one Error 503 because of the following errors (this errors are written in my debug.log all the times I refresh the page and I have the 503 Error):
[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: before_widget in
/var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-
extra-widgets/widgets/woo/best-products.php on line 77
[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: after_widget in
/var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-
extra-widgets/widgets/woo/best-products.php on line 93
[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: widget_id in
/var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-
extra-widgets/widgets/woo/best-products.php on line 96When having this error, a momentaneous error message 503 appears and my
page is down for a moment (it could be seconds or minutes).
Here are the lines of code referenced by the error (the bold ones).{{{
public function widget( $args, $instance ) {
$cache = array();
if ( ! $this->is_preview() ) {
$cache = wp_cache_get( ‘woo_best_products’,
‘widget’ );
}if ( ! is_array( $cache ) ) {
$cache = array();
}if ( ! isset( $args[‘widget_id’] ) ) {
$args[‘widget_id’] = $this->id;
}if ( isset( $cache[ $args[‘widget_id’] ] ) ) {
echo $cache[ $args[‘widget_id’] ];return;
}ob_start();
$title = ( ! empty( $instance[‘title’] ) ) ?
$instance[‘title’] : ”;
$title = apply_filters( ‘widget_title’, $title, $instance,
$this->id_base );if ( ” == $title ) {
$title = __( ‘Best Sellers’, ‘themeisle-companion’
);
}$limit = ( ! empty( $instance[‘limit’] ) ) ? absint(
$instance[‘limit’] ) : 4;
if ( ” == $limit ) {
$limit = 4;
}
$columns = ( ! empty( $instance[‘columns’] ) ) ? absint(
$instance[‘columns’] ) : 4;if ( ” == $columns ) {
$columns = 4;
}$args = apply_filters(
‘elementor-addon-widgets_product_categories_args’,
array(
‘limit’ => $limit,
‘columns’ => $columns,
‘title’ => $title,
‘orderby’ => ‘date’,
‘order’ => ‘desc’,
)
);
77—-> echo $args[‘before_widget’];
echo ‘<section class=”eaw-product-section woo-best-
products”>’;do_action(
‘storepage_homepage_before_best_selling_products’ );
echo ‘<h2 class=”section-title”>’ . wp_kses_post(
$args[‘title’] ) . ‘</h2>’;do_action(
‘storepage_homepage_after_best_selling_products_title’ );
echo $this->do_shortcode(
‘best_selling_products’, array(
‘per_page’ => intval( $args[‘limit’] ),
‘columns’ => intval( $args[‘columns’] ),
)
);
do_action(
‘storepage_homepage_after_best_selling_products’ );echo ‘</section>’;
93—-> echo $args[‘after_widget’];if ( ! $this->is_preview() ) {
96—-> $cache[ $args[‘widget_id’] ] = ob_get_flush();
wp_cache_set( ‘woo_best_products’, $cache,
‘widget’ );
} else {
ob_end_flush();
}
}
}}}The page I need help with: [log in to see the link]
- The topic ‘PHP notice: Undefined index: before_widget’ is closed to new replies.