Skip to content

Instantly share code, notes, and snippets.

@glueckpress
Last active October 5, 2023 09:54
Show Gist options
  • Save glueckpress/0fcd12a8ada43e37e400facd987016a1 to your computer and use it in GitHub Desktop.
Save glueckpress/0fcd12a8ada43e37e400facd987016a1 to your computer and use it in GitHub Desktop.
[WordPress][WP Rocket] Remove Cache Options meta box from Edit screens.
<?php
/**
* PLEASE SEE COMMENT BELOW:
* https://gist.github.com/glueckpress/0fcd12a8ada43e37e400facd987016a1#gistcomment-3009533
*/
defined( 'ABSPATH' ) or die();
/**
* Plugin Name: WP Rocket | Remove Cache Options Meta Boxx
* Description: Removes the Cache Options meta box from Edit screens.
* Author: Caspar Hübinger
* Author URI: https://profiles.wordpress.org/glueckpress
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
add_action( 'wp_rocket_loaded', function () {
remove_action( 'add_meta_boxes', 'rocket_cache_options_meta_boxes' );
});
@Frique
Copy link

Frique commented Oct 5, 2023

This doesn't work anymore (since version 3.15), so this is an alternative:
add_filter( 'rocket_metabox_options_post_types', '__return_empty_array' );
It indicates that you want the metabox to be shown on 0 post types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment