← All changes
|
includes/api/class-content-type-matrix-endpoint.php
+22
-5
2.5.0
→
2.14.0
View file →
| @@ -130,8 +130,14 @@ | ||
| 130 | 130 | |
| 131 | 131 | $entity['values'] = $values; |
| 132 | 132 | $entity['robots_meta_enabled'] = !empty($stored['robots_meta_enabled']); |
| 133 | 133 | $entity['robots_meta'] = Content_Type_Settings::resolve_robots_meta($entity['key']); |
| 134 | + // What the row falls back to with the pin off, so the matrix can | |
| 135 | + // label its Inherit option per row rather than guessing. It is not | |
| 136 | + // the same for every row: search and 404 default to noindex (#838). | |
| 137 | + $entity['default_noindex'] = !empty( | |
| 138 | + Content_Type_Settings::default_robots_meta($entity['key'])['noindex'] | |
| 139 | + ); | |
| 134 | 140 | $entity['sitemap_include'] = $entity['supports_sitemap'] |
| 135 | 141 | ? Content_Type_Settings::is_included_in_sitemap($entity['group'], $entity['object'], $sitemap_settings) |
| 136 | 142 | : null; |
| 137 | 143 | |
| @@ -220,8 +226,9 @@ | ||
| 220 | 226 | array_flip(Content_Type_Settings::FEATURES) |
| 221 | 227 | ), |
| 222 | 228 | 'robots_meta_enabled' => !empty(Content_Type_Settings::get_entity_settings($entity_key)['robots_meta_enabled']), |
| 223 | 229 | 'robots_meta' => Content_Type_Settings::resolve_robots_meta($entity_key), |
| 230 | + 'default_noindex' => !empty(Content_Type_Settings::default_robots_meta($entity_key)['noindex']), | |
| 224 | 231 | 'sitemap_include' => $descriptor['supports_sitemap'] |
| 225 | 232 | ? Content_Type_Settings::is_included_in_sitemap($descriptor['group'], $descriptor['object'], $sitemap_settings) |
| 226 | 233 | : null, |
| 227 | 234 | ], |
| @@ -284,18 +291,28 @@ | ||
| 284 | 291 | $manager = new \ThinkRank\SEO\Social_Meta_Manager(); |
| 285 | 292 | $social = $manager->get_settings('site'); |
| 286 | 293 | } |
| 287 | 294 | |
| 288 | - $ga_measurement_id = (string) \ThinkRank\Core\Settings::instance()->get('ga4_measurement_id', ''); | |
| 289 | - $ga_auto_inject = (bool) \ThinkRank\Core\Settings::instance()->get('ga4_auto_inject', false); | |
| 290 | - | |
| 291 | - return [ | |
| 295 | + $defaults = [ | |
| 292 | 296 | Content_Type_Settings::FEATURE_META => true, |
| 293 | 297 | Content_Type_Settings::FEATURE_SCHEMA => true, |
| 294 | 298 | Content_Type_Settings::FEATURE_OPEN_GRAPH => !empty($social['enable_open_graph'] ?? $social['og_enabled'] ?? false), |
| 295 | 299 | Content_Type_Settings::FEATURE_TWITTER => !empty($social['enable_twitter_cards'] ?? $social['twitter_enabled'] ?? false), |
| 296 | - Content_Type_Settings::FEATURE_ANALYTICS => $ga_auto_inject && $ga_measurement_id !== '', | |
| 300 | + // The GA4 tag this switch gates is installed by ThinkRank Pro, | |
| 301 | + // which answers the filter below with its own site-wide state. | |
| 302 | + Content_Type_Settings::FEATURE_ANALYTICS => false, | |
| 297 | 303 | ]; |
| 304 | + | |
| 305 | + /** | |
| 306 | + * Filters the site-wide value each 'inherit' matrix cell resolves to. | |
| 307 | + * | |
| 308 | + * @since 2.6.0 | |
| 309 | + * | |
| 310 | + * @param array<string, bool> $defaults Feature key => site-wide value. | |
| 311 | + */ | |
| 312 | + $filtered = apply_filters('thinkrank_content_type_matrix_global_defaults', $defaults); | |
| 313 | + | |
| 314 | + return is_array($filtered) ? array_map('boolval', $filtered + $defaults) : $defaults; | |
| 298 | 315 | } |
| 299 | 316 | |
| 300 | 317 | /** |
| 301 | 318 | * Sitemap settings for the site context. |