Skip to content

Commit f637944

Browse files
committed
fix: widget loading in debug mode & when disconnected
1 parent 8b10137 commit f637944

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

inc/dashboard_widget.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public function init() {
2828
* Add the dashboard widget.
2929
*/
3030
public function add_dashboard_widget() {
31+
if ( ! $this->has_at_least_ten_visits() ) {
32+
return;
33+
}
34+
3135
wp_add_dashboard_widget( $this->handle, sprintf( 'Optimole - %s', __( 'Image Optimization Stats', 'optimole' ) ), [ $this, 'render_widget' ] );
3236
}
3337

@@ -71,7 +75,9 @@ private function is_main_dashboard_page() {
7175
* @return bool
7276
*/
7377
private function has_at_least_ten_visits() {
74-
if ( OPTML_DEBUG ) {
78+
$settings = new Optml_Settings();
79+
80+
if ( OPTML_DEBUG && $settings->is_connected() ) {
7581
return true;
7682
}
7783

0 commit comments

Comments
 (0)