Created
February 14, 2020 08:08
-
-
Save vmanthos/878f568c310212aaa4cc9fe243731da5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WP Rocket | Disable permissions warnings about "cache" folders | |
* Description: It will prevent WP Rocket from displaying warnings on environments where the "cache" folders aren't writeable. | |
* Author: Vasilis Manthos | |
* License: GNU General Public License v3 or later | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
// Basic security, prevents file from being loaded directly. | |
defined( 'ABSPATH' ) or die( 'Cheatin’ uh?' ); | |
function wp_rocket_disable_permissions_warnings(){ | |
remove_action( 'admin_notices', 'rocket_warning_cache_dir_permissions' ); | |
remove_action( 'admin_notices', 'rocket_warning_minify_cache_dir_permissions' ); | |
remove_action( 'admin_notices', 'rocket_warning_busting_cache_dir_permissions' ); | |
add_action( 'wp_loaded', function() { | |
$container = apply_filters( 'rocket_container', ''); | |
$container->get('event_manager')->remove_callback( 'admin_notices', [ $container->get('critical_css_subscriber'), 'warning_critical_css_dir_permissions'] ); | |
} ); | |
} | |
add_action( 'wp_rocket_loaded', 'wp_rocket_disable_permissions_warnings' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment