HEX
Server: Apache/2.4.66 (Debian)
System: Linux 6dfabc3b2241 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User: (1000)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //var/www/html/fix-support-cae-final.php
<?php
/**
 * Fix hero content and tab label on Support CAE page.
 * Hero: use Figma placeholder text (shared component)
 * Tab: "The Different Ways to Give" per sitemap
 */

$post_id = 25;
$post = get_post($post_id);
$blocks = parse_blocks($post->post_content);

foreach ($blocks as &$block) {
    // Fix hero
    if ($block['blockName'] === 'acf/hero' && isset($block['attrs']['data'])) {
        $block['attrs']['data']['hero_heading'] = 'MISSION, VISION AND VALUES';
        $block['attrs']['data']['_hero_heading'] = 'field_hero_heading';
        $block['attrs']['data']['hero_description'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco';
        $block['attrs']['data']['_hero_description'] = 'field_hero_description';
        $block['attrs']['data']['hero_button'] = ['title' => 'Lorem Ipsum', 'url' => '#', 'target' => ''];
        $block['attrs']['data']['_hero_button'] = 'field_hero_button';
        WP_CLI::log('Hero: updated to Figma spec text');
    }

    // Fix tab label
    if ($block['blockName'] === 'acf/support-cae' && isset($block['attrs']['data'])) {
        // Find the active tab (Ways to Give) and fix its label
        if (isset($block['attrs']['data']['support_cae_tabs_1_tab_label'])) {
            $block['attrs']['data']['support_cae_tabs_1_tab_label'] = 'The Different Ways to Give';
            WP_CLI::log('Tab: fixed to "The Different Ways to Give"');
        }
    }
}

$new_content = serialize_blocks($blocks);
wp_update_post(['ID' => $post_id, 'post_content' => $new_content]);
wp_cache_flush();

// Verify
$rendered = apply_filters('the_content', get_post($post_id)->post_content);
$has_mvv = strpos($rendered, 'MISSION, VISION AND VALUES') !== false;
$has_tab = strpos($rendered, 'The Different Ways to Give') !== false;

WP_CLI::success("Hero: " . ($has_mvv ? 'YES' : 'NO') . ", Tab label: " . ($has_tab ? 'YES' : 'NO'));