Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,
    Same here, impossible to disable cache notice in admin.
    Even if I put lines in functions.php :

    add_filter('wp_statistics_cache_status', function ($status) {
        $status['status'] = false;
        return $status;
    });

    “wp-cache is detected” message always appears in admin.
    Thanks

    Reza

    (@reventon94)

    Hi,

    I hope you all are doing well.

    To remove this notice from your WP dashboard, you can add the following lines of code to the function.php of your theme.

    add_filter('wp_statistics_cache_status', function ($status) {
        $status['status'] = false;
        return $status;
    });

    I’ve already tested it and it works.

    Best Regards

    I am not sure why this issue has been closed as resolved, despite users saying that the suggested solution doesn’t work. It doesn’t work for me either.

    And the reason it doesn’t work is because the plugin has incorrect logic.

    In the file, includes/class-wp-statistics-helper.php:175, in function is_active_cache_plugin() instead of initialising and never using the variable $use for early exit, like using a guard clause. It should instead assume status true, then apply filter, and then early exit based on filter. Like shown below.

    From line 177

    $use = array('status' => true, 'plugin' => '');
            $use = apply_filters('wp_statistics_cache_status', $use);
            
            if (isset($use) and is_array($use) and $use['status'] === false) {
                return $use;
            }

    And then remove the last line in that function, which is never reached anyway. return apply_filters('wp_statistics_cache_status', $use);

    This is, of course, in conjunction with defining the filter in a theme’s functions.php.

    • This reply was modified 1 year, 9 months ago by darkfish.caver. Reason: Add info on required add_filter in theme functions
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘hide admin info’ is closed to new replies.