Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions tests/php/seo-remediation-links-smoke.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ function check( $condition, $message ) {
$g_wagon_copy = '<p>The attention to detail is obsessive, with custom upholstery, illuminated logos, and unique trim options.</p>'
. '<p>Popular upgrades include forged wheels ($12,000-$20,000), carbon fiber body kits ($25,000+), and exclusive interior packages.</p>';

$g63_copy = '<p>Notable milestones include the introduction of the Brabus Widestar body kit in the 1980s.</p>'
. '<p>Signature touches include the Widestar body kit, forged wheels up to 23 inches, and carbon fiber aerodynamic elements.</p>';
$g63_copy = '<p>Signature touches include the Widestar body kit, forged wheels, and carbon fiber aerodynamic elements.</p>';

$filter = $GLOBALS['filters']['the_content'][0];

Expand All @@ -63,17 +62,14 @@ function check( $condition, $message ) {
$out2 = $filter( $out );
check( substr_count( $out2, 'utm_content=monoblock_r_23' ) === 1, 'repeat render does not duplicate links' );

// G63 guide: second occurrence of the Widestar phrase is the one linked.
// G63 guide: the first Widestar mention is the one linked.
$GLOBALS['mock_slug'] = 'g63-brabus-price';
$out = $filter( $g63_copy );
check( substr_count( $out, 'utm_content=widestar_pkg1' ) === 1, 'widestar linked once on g63' );
$first = strpos( $out, 'milestones' );
$second = strpos( $out, 'Signature touches' );
$link_at = strpos( $out, 'utm_content=widestar_pkg1' );
check( $link_at > $second, 'design-paragraph occurrence linked, not the history mention' );
check( false === strpos( substr( $out, $first, $second - $first ), '<a href=' ), 'history paragraph left unlinked' );
check( substr_count( $out, 'utm_content=monoblock_r_23' ) === 1, 'wheels linked on g63' );
check( substr_count( $out, 'utm_content=widestar_w463a' ) === 1, 'widestar linked once on g63' );
check( str_contains( $out, '>Widestar body kit</a>' ), 'widestar anchor preserved' );
check( substr_count( $out, 'utm_content=carbon_body_trims' ) === 1, 'carbon trims linked on g63' );
$out3 = $filter( $out );
check( substr_count( $out3, 'utm_content=widestar_w463a' ) === 1 && substr_count( $out3, 'utm_content=carbon_body_trims' ) === 1, 'g63 repeat render does not duplicate' );

// An anchor already inside a link is not wrapped again.
$GLOBALS['mock_slug'] = 'price-of-g-wagon-brabus';
Expand Down
16 changes: 5 additions & 11 deletions wp-content/themes/3w-2025/inc/seo-remediation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Purge stale full-page cache once when this remediation version ships.
*/
add_action( 'init', function () {
$cache_version = '2026-11-22-3';
$cache_version = '2026-11-30-1';
if ( get_option( 'threew_seo_remediation_cache_version' ) === $cache_version ) {
return;
}
Expand All @@ -38,11 +38,11 @@ function threew_2025_get_price_guide_seo() {
return [
'price-of-g-wagon-brabus' => [
'title' => 'BRABUS G-Wagon Price: G63, 700, 800 & 900 Costs',
'description' => 'BRABUS G-Wagon prices: the 700 starts around $375,000, the 800 from $425,000, the 900 Rocket from $500,000+. Most North American buyers pay $400,000-$550,000.',
'description' => 'A W463-A BRABUS WIDESTAR parts kit is $36,794.25. Complete BRABUS G-Wagons are listed from about €559,000 gross. Compare both routes before you buy.',
],
'g63-brabus-price' => [
'title' => 'Mercedes-AMG G63 BRABUS Price & Upgrade Costs',
'description' => 'A G63 starts around $180,000-$200,000. A BRABUS 700 conversion adds $100,000-$150,000, and the 800 adds $180,000-$250,000. See what a full build costs.',
'description' => 'A new G 63 starts at $198,750. A BRABUS 800 complete vehicle lists from about €559,000 gross. Compare a parts conversion with buying the finished truck.',
],
];
}
Expand Down Expand Up @@ -77,14 +77,8 @@ function threew_2025_get_price_guide_product_links() {
'g63-brabus-price' => [
[
'anchor' => 'Widestar body kit',
'path' => '/product/brabus-w465-widestar-kit-carbon-fiber-package-1/',
'utm_content' => 'widestar_pkg1',
'occurrence' => 2,
],
[
'anchor' => 'forged wheels up to 23 inches',
'path' => '/product/brabus-monoblock-r-platinum-edition-5-double-spoke-rims-forged-anthracite-titan-polished-for-the-mercedes-benz-g-class-w463/',
'utm_content' => 'monoblock_r_23',
'path' => '/product/brabus-widestar-for-w463-a/',
'utm_content' => 'widestar_w463a',
],
[
'anchor' => 'carbon fiber aerodynamic elements',
Expand Down
Loading