true, ], 'objects' ); /** * Filters the post type on submitbox. * * @since 3.12.1 * * @param array $cpts Post Types. */ $cpts = apply_filters( 'rocket_submitbox_options_post_types', $cpts ); if ( isset( $cpts[ $post->post_type ] ) ) { $url = wp_nonce_url( admin_url( 'admin-post.php?action=purge_cache&type=post-' . $post->ID ), 'purge_cache_post-' . $post->ID ); printf( '
%s
', esc_url( $url ), esc_html__( 'Clear cache', 'rocket' ) ); } } } add_action( 'post_submitbox_start', 'rocket_post_submitbox_start' ); /** * Add "Cache options" metabox * * @since 2.5 */ function rocket_cache_options_meta_boxes() { if ( ! rocket_can_display_options() ) { return; } if ( current_user_can( 'rocket_manage_options' ) ) { $cpts = get_post_types( [ 'public' => true, ], 'objects' ); unset( $cpts['attachment'] ); $cpts = apply_filters( 'rocket_metabox_options_post_types', $cpts ); foreach ( $cpts as $cpt => $cpt_object ) { $label = $cpt_object->labels->singular_name; add_meta_box( 'rocket_post_exclude', sprintf( __( 'WP Rocket Options', 'rocket' ), $label ), 'rocket_display_cache_options_meta_boxes', $cpt, 'side', 'core' ); } } } add_action( 'add_meta_boxes', 'rocket_cache_options_meta_boxes' ); /** * Displays some checkbox to de/activate some cache options * * @since 2.5 */ function rocket_display_cache_options_meta_boxes() { if ( current_user_can( 'rocket_manage_options' ) ) { global $post, $pagenow; wp_nonce_field( 'rocket_box_option', '_rocketnonce', false, true ); ?>
ID ) ); if ( isset( $rejected_uris[ $path ] ) ) { $reject_current_uri = true; } } ?> >

__( 'LazyLoad for images', 'rocket' ), 'lazyload_iframes' => __( 'LazyLoad for iframes/videos', 'rocket' ), 'minify_css' => __( 'Minify/combine CSS', 'rocket' ), 'remove_unused_css' => __( 'Remove Unused CSS', 'rocket' ), 'minify_js' => __( 'Minify/combine JS', 'rocket' ), 'cdn' => __( 'CDN', 'rocket' ), 'async_css' => __( 'Load CSS asynchronously', 'rocket' ), 'defer_all_js' => __( 'Defer JS', 'rocket' ), 'delay_js' => __( 'Delay JavaScript execution', 'rocket' ), ]; foreach ( $fields as $field => $label ) { $disabled = disabled( ! get_rocket_option( $field ), true, false ); // translators: %s is the name of the option. $title = $disabled ? ' title="' . esc_attr( sprintf( __( 'Activate first the %s option.', 'rocket' ), $label ) ) . '"' : ''; $class = $disabled ? ' class="rkt-disabled"' : ''; $checked = ! $disabled ? checked( ! get_post_meta( $post->ID, '_rocket_exclude_' . $field, true ), true, false ) : ''; ?> >

', '' ); ?>