PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.8.6
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.8.6
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
← All changes | admin/class-convertkit-admin-cache-plugins.php +36 -6 3.4.22.8.6 View file →
@@ -53,16 +53,11 @@
53 53 * @since 2.2.2
54 54 */
55 55 public function maybe_configure_cache_plugins() {
56 56
57 - // Only allow Administrators to update third party Plugin settings.
58 - if ( ! current_user_can( 'manage_options' ) ) {
59 - return;
60 - }
61 -
62 57 // If no Pages, Posts or CPTs are configured to use Restrict Content, don't
63 58 // configure any caching plugins.
64 - if ( ! WP_ConvertKit()->get_class( 'admin_restrict_content' )->restrict_content_enabled() ) {
59 + if ( ! $this->restrict_content_enabled() ) {
65 60 return;
66 61 }
67 62
68 63 $this->litespeed_cache();
@@ -70,8 +65,43 @@
70 65 $this->wp_fastest_cache();
71 66 $this->wp_optimize();
72 67 $this->wp_rocket();
73 68 $this->wp_super_cache();
69 +
70 + }
71 +
72 + /**
73 + * Check if any Pages, Posts or CPTs are configured to use Restrict Content.
74 + *
75 + * @since 2.7.6
76 + *
77 + * @return bool
78 + */
79 + private function restrict_content_enabled() {
80 +
81 + // Check if any Pages, Posts or CPTs are configured to use Restrict Content.
82 + $query = new WP_Query(
83 + array(
84 + 'post_type' => convertkit_get_supported_post_types(),
85 + 'post_status' => 'publish',
86 + 'meta_query' => array(
87 + array(
88 + 'key' => '_wp_convertkit_post_meta',
89 + 'value' => '"restrict_content";',
90 + 'compare' => 'LIKE',
91 + ),
92 + array(
93 + 'key' => '_wp_convertkit_post_meta',
94 + 'value' => '"restrict_content";s:1:"0"',
95 + 'compare' => 'NOT LIKE',
96 + ),
97 + ),
98 + 'posts_per_page' => 1,
99 + 'fields' => 'ids',
100 + )
101 + );
102 +
103 + return $query->have_posts();
74 104
75 105 }
76 106
77 107 /**