Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
CRAP
n/a
0 / 0
Automattic\Jetpack_Boost\Compatibility\Elementor\exclude_elementor_library_custom_post_type
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
30
1<?php
2/**
3 * Compatibility functions for Elementor
4 *
5 * @package automattic/jetpack-boost
6 */
7
8namespace Automattic\Jetpack_Boost\Compatibility\Elementor;
9
10/**
11 * Exclude Elementor Library custom post type from the list of post types to get urls from.
12 *
13 * @param array $post_types Post types.
14 */
15function exclude_elementor_library_custom_post_type( $post_types ) {
16    if ( defined( '\Elementor\TemplateLibrary\Source_Local::CPT' ) ) {
17        unset( $post_types[ \Elementor\TemplateLibrary\Source_Local::CPT ] );
18    }
19
20    // Elementor's landing pages are broken. See https://github.com/elementor/elementor/issues/16244
21    if ( defined( '\Elementor\Modules\LandingPages\Module::CPT' ) ) {
22        unset( $post_types[ \Elementor\Modules\LandingPages\Module::CPT ] );
23    }
24
25    if ( defined( '\Elementor\Modules\FloatingButtons\Module::CPT_FLOATING_BUTTONS' ) ) {
26        unset( $post_types[ \Elementor\Modules\FloatingButtons\Module::CPT_FLOATING_BUTTONS ] );
27    }
28
29    if ( isset( $post_types['elementor-hf'] ) ) {
30        unset( $post_types['elementor-hf'] );
31    }
32
33    return $post_types;
34}
35
36add_filter( 'jetpack_boost_critical_css_post_types_singular', __NAMESPACE__ . '\exclude_elementor_library_custom_post_type' );
37add_filter( 'jetpack_boost_critical_css_post_types_archives', __NAMESPACE__ . '\exclude_elementor_library_custom_post_type' );