PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.10.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.10.0
2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk 1.0.0 All 52 releases
← All changes | includes/seo/class-global-seo-post-types.php +57 -3 1.29.0 → 2.10.0 View file →
@@ -54,9 +54,56 @@
54 54 if ($object->_builtin === false && !is_post_type_viewable($object)) {
55 55 return false;
56 56 }
57 57
58 - // Named deny list for viewable-but-unsuitable builder/utility CPTs.
58 + return !in_array($object->name, self::excluded_post_types($object), true);
59 + }
60 +
61 + /**
62 + * Every post type that passes {@see self::is_allowed()}.
63 + *
64 + * The sitewide half of duplicate snippet detection needs the whole list
65 + * rather than one name, because a duplicate title is a duplicate whichever
66 + * post type the other page happens to be (#564).
67 + *
68 + * @since 2.10.0
69 + *
70 + * @return string[] Post type names.
71 + */
72 + public static function allowed(): array {
73 + $allowed = [];
74 +
75 + foreach (get_post_types(['public' => true], 'objects') as $object) {
76 + if (self::is_allowed($object)) {
77 + $allowed[] = $object->name;
78 + }
79 + }
80 +
81 + return $allowed;
82 + }
83 +
84 + /**
85 + * Builder and utility CPTs that are not optimizable content.
86 + *
87 + * These register `public => true` for preview purposes but are layout
88 + * fragments, not pages anyone gives a title and a meta description.
89 + *
90 + * Shared rather than duplicated: the per-post SEO metabox discovers post
91 + * types by the same public/`show_ui` rule and used to keep its own
92 + * exclusion list, which named only WordPress internals. The two policies
93 + * disagreed — a builder template CPT was denied Global SEO while still
94 + * getting a full metabox — so both now read this one list (#621).
95 + *
96 + * @since 2.2.1
97 + *
98 + * Deliberately untyped: this is passed straight to a public filter whose
99 + * existing contract accepts whatever the caller has (a `WP_Post_Type`, or
100 + * null when the list is wanted without a subject).
101 + *
102 + * @param mixed $post_type_object Post type being judged, passed to the filter.
103 + * @return string[] Post type names to exclude.
104 + */
105 + public static function excluded_post_types($post_type_object = null): array {
59 106 // Filterable so integrators can tune it without patching core. The
60 107 // post-type object is passed as the second argument (matches the admin
61 108 // discovery filter usage).
62 109 $excluded = apply_filters('thinkrank_global_seo_excluded_post_types', [
@@ -64,9 +111,16 @@
64 111 'e-floating-buttons', 'elementor_component',
65 112 // Divi: the library plus every Theme Builder template type.
66 113 'et_pb_layout', 'et_theme_builder', 'et_template',
67 114 'et_header_layout', 'et_body_layout', 'et_footer_layout',
68 - ], $object);
115 + // Beaver Builder: saved templates (rows, columns, modules) and
116 + // Beaver Themer's layouts. Same clutter Divi's Theme Builder
117 + // templates caused before they were listed here (#449).
118 + 'fl-builder-template', 'fl-theme-layout',
119 + // Bricks: saved templates plus the header/footer/section layouts
120 + // its Theme Builder stores as the same CPT (#257).
121 + 'bricks_template',
122 + ], $post_type_object);
69 123
70 - return !in_array($object->name, (array) $excluded, true);
124 + return array_values(array_filter((array) $excluded, 'is_string'));
71 125 }
72 126 }