| @@ -397,9 +397,25 @@ | ||
| 397 | 397 | 'business_phone', 'business_email', 'business_hours', |
| 398 | 398 | 'business_latitude', 'business_longitude', 'business_price_range', |
| 399 | 399 | ]; |
| 400 | 400 | |
| 401 | - if (empty(array_intersect_key($settings, array_flip($business_keys)))) { | |
| 401 | + // Which deployed types a Site Identity key can invalidate. The business | |
| 402 | + // block feeds LocalBusiness and Organization; alternate_name feeds the | |
| 403 | + // WebSite node, which had no entry here at all — so editing it left the | |
| 404 | + // deployed schema showing the previous value until something else | |
| 405 | + // happened to redeploy (#692). | |
| 406 | + $refresh_types = []; | |
| 407 | + | |
| 408 | + if (!empty(array_intersect_key($settings, array_flip($business_keys)))) { | |
| 409 | + $refresh_types[] = 'LocalBusiness'; | |
| 410 | + $refresh_types[] = 'Organization'; | |
| 411 | + } | |
| 412 | + | |
| 413 | + if (array_key_exists('alternate_name', $settings)) { | |
| 414 | + $refresh_types[] = 'WebSite'; | |
| 415 | + } | |
| 416 | + | |
| 417 | + if (empty($refresh_types)) { | |
| 402 | 418 | return; |
| 403 | 419 | } |
| 404 | 420 | |
| 405 | 421 | $schema_settings = $this->get_settings($context_type, $context_id); |
| @@ -409,9 +425,9 @@ | ||
| 409 | 425 | |
| 410 | 426 | // Only refresh types that are actually deployed, so this never adds a |
| 411 | 427 | // type the admin did not enable. |
| 412 | 428 | $deployed = array_keys((array) $this->get_deployed_schemas($context_type, $context_id)); |
| 413 | - $affected = array_values(array_intersect($deployed, ['LocalBusiness', 'Organization'])); | |
| 429 | + $affected = array_values(array_intersect($deployed, $refresh_types)); | |
| 414 | 430 | |
| 415 | 431 | if (empty($affected)) { |
| 416 | 432 | return; |
| 417 | 433 | } |
| @@ -1586,9 +1602,9 @@ | ||
| 1586 | 1602 | if ($post) { |
| 1587 | 1603 | $content_data = [ |
| 1588 | 1604 | 'title' => $post->post_title, |
| 1589 | 1605 | 'url' => get_permalink($post->ID), |
| 1590 | - 'excerpt' => $post->post_excerpt ?: wp_trim_words($post->post_content, 30), | |
| 1606 | + 'excerpt' => $post->post_excerpt ?: \ThinkRank\Core\Seo_Text::trim_words($post->post_content, 30), | |
| 1591 | 1607 | 'content' => $post->post_content, |
| 1592 | 1608 | 'author' => [ |
| 1593 | 1609 | 'name' => get_the_author_meta('display_name', $post->post_author), |
| 1594 | 1610 | 'url' => get_author_posts_url($post->post_author) |
| @@ -2598,8 +2614,11 @@ | ||
| 2598 | 2614 | 'site_url' => home_url(), |
| 2599 | 2615 | 'admin_email' => get_option('admin_email'), |
| 2600 | 2616 | 'language' => get_locale(), |
| 2601 | 2617 | 'timezone' => get_option('timezone_string'), |
| 2618 | + // Read by populate_website_schema(), so the deployed WebSite node | |
| 2619 | + // carries the same alternateName as the default one (#692). | |
| 2620 | + 'alternate_name' => $site_identity_settings['alternate_name'] ?? '', | |
| 2602 | 2621 | 'founded_date' => $site_identity_settings['founded_date'] ?? '', |
| 2603 | 2622 | 'founder_name' => $site_identity_settings['founder_name'] ?? '', |
| 2604 | 2623 | 'company_type' => $site_identity_settings['company_type'] ?? 'Organization', |
| 2605 | 2624 | // Site Identity assets |