| @@ -54,9 +54,33 @@ | ||
| 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 | + * Builder and utility CPTs that are not optimizable content. | |
| 63 | + * | |
| 64 | + * These register `public => true` for preview purposes but are layout | |
| 65 | + * fragments, not pages anyone gives a title and a meta description. | |
| 66 | + * | |
| 67 | + * Shared rather than duplicated: the per-post SEO metabox discovers post | |
| 68 | + * types by the same public/`show_ui` rule and used to keep its own | |
| 69 | + * exclusion list, which named only WordPress internals. The two policies | |
| 70 | + * disagreed — a builder template CPT was denied Global SEO while still | |
| 71 | + * getting a full metabox — so both now read this one list (#621). | |
| 72 | + * | |
| 73 | + * @since 2.2.1 | |
| 74 | + * | |
| 75 | + * Deliberately untyped: this is passed straight to a public filter whose | |
| 76 | + * existing contract accepts whatever the caller has (a `WP_Post_Type`, or | |
| 77 | + * null when the list is wanted without a subject). | |
| 78 | + * | |
| 79 | + * @param mixed $post_type_object Post type being judged, passed to the filter. | |
| 80 | + * @return string[] Post type names to exclude. | |
| 81 | + */ | |
| 82 | + public static function excluded_post_types($post_type_object = null): array { | |
| 59 | 83 | // Filterable so integrators can tune it without patching core. The |
| 60 | 84 | // post-type object is passed as the second argument (matches the admin |
| 61 | 85 | // discovery filter usage). |
| 62 | 86 | $excluded = apply_filters('thinkrank_global_seo_excluded_post_types', [ |
| @@ -64,9 +88,16 @@ | ||
| 64 | 88 | 'e-floating-buttons', 'elementor_component', |
| 65 | 89 | // Divi: the library plus every Theme Builder template type. |
| 66 | 90 | 'et_pb_layout', 'et_theme_builder', 'et_template', |
| 67 | 91 | 'et_header_layout', 'et_body_layout', 'et_footer_layout', |
| 68 | - ], $object); | |
| 92 | + // Beaver Builder: saved templates (rows, columns, modules) and | |
| 93 | + // Beaver Themer's layouts. Same clutter Divi's Theme Builder | |
| 94 | + // templates caused before they were listed here (#449). | |
| 95 | + 'fl-builder-template', 'fl-theme-layout', | |
| 96 | + // Bricks: saved templates plus the header/footer/section layouts | |
| 97 | + // its Theme Builder stores as the same CPT (#257). | |
| 98 | + 'bricks_template', | |
| 99 | + ], $post_type_object); | |
| 69 | 100 | |
| 70 | - return !in_array($object->name, (array) $excluded, true); | |
| 101 | + return array_values(array_filter((array) $excluded, 'is_string')); | |
| 71 | 102 | } |
| 72 | 103 | } |