← All changes
|
includes/admin/importers/class-rankmath-exporter.php
+19
-1
2.10.0
→
2.12.0
View file →
| @@ -285,8 +285,14 @@ | ||
| 285 | 285 | 'twitter_description' => $this->convert_template_variables($meta['rank_math_twitter_description'] ?? '', $post_id), |
| 286 | 286 | 'twitter_image' => $meta['rank_math_twitter_image'] ?? '', |
| 287 | 287 | 'primary_category' => (int) ($meta['rank_math_primary_category'] ?? 0), |
| 288 | 288 | 'schema_type' => $this->resolve_schema_type($meta), |
| 289 | + // WooCommerce product identifier. Rank Math keeps it in its | |
| 290 | + // own per-post meta; ThinkRank Pro reads the canonical field | |
| 291 | + // this maps to, so a migrating store keeps the identifier | |
| 292 | + // Google asks for instead of collecting a "missing | |
| 293 | + // identifier" warning on every product (#715). | |
| 294 | + 'product_identifier' => (string) ($meta['rank_math_gtin_code'] ?? ''), | |
| 289 | 295 | // Rank Math pillar content maps directly to ThinkRank pillar content. |
| 290 | 296 | 'pillar_content' => $this->normalize_pillar_content($meta['rank_math_pillar_content'] ?? ''), |
| 291 | 297 | ], |
| 292 | 298 | 'extended' => [ |
| @@ -1101,13 +1107,25 @@ | ||
| 1101 | 1107 | |
| 1102 | 1108 | // Rank Math token => ThinkRank Global SEO token (structure preserved). |
| 1103 | 1109 | $token_map = [ |
| 1104 | 1110 | '%name%' => '%author%', // Rank Math author display name token |
| 1111 | + // WooCommerce product variables. Rank Math lets a product title or | |
| 1112 | + // description carry the price, SKU and stock status; every one of | |
| 1113 | + // them used to be stripped by the pass below, so "Buy %title% for | |
| 1114 | + // %wc_price%" imported as "Buy %title% for" (#715). | |
| 1115 | + '%wc_price%' => '%price%', | |
| 1116 | + '%wc_sku%' => '%sku%', | |
| 1117 | + '%wc_shortdesc%' => '%short_description%', | |
| 1118 | + '%wc_brand%' => '%brand%', | |
| 1105 | 1119 | ]; |
| 1106 | 1120 | $template = str_replace(array_keys($token_map), array_values($token_map), $template); |
| 1107 | 1121 | |
| 1108 | 1122 | // Tokens ThinkRank's Global SEO engine resolves natively — keep as-is. |
| 1109 | - $supported = ['%title%', '%sitename%', '%sep%', '%excerpt%', '%date%', '%modified%', '%author%', '%category%']; | |
| 1123 | + $supported = [ | |
| 1124 | + '%title%', '%sitename%', '%sep%', '%excerpt%', '%date%', '%modified%', '%author%', '%category%', | |
| 1125 | + // Resolved by Pattern_Resolver on a product, empty elsewhere. | |
| 1126 | + '%price%', '%sale_price%', '%sku%', '%stock_status%', '%short_description%', '%brand%', | |
| 1127 | + ]; | |
| 1110 | 1128 | |
| 1111 | 1129 | // Strip any token ThinkRank cannot resolve so it does not render literally. |
| 1112 | 1130 | $template = preg_replace_callback( |
| 1113 | 1131 | '/%[a-z0-9_]+%/i', |