Changeset 3398651
- Timestamp:
- 11/19/2025 08:38:40 AM (4 months ago)
- Location:
- infility-global/trunk
- Files:
-
- 2 edited
-
infility_global.php (modified) (2 diffs)
-
widgets/infility-import-data/include/infility-import-seo.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
infility-global/trunk/infility_global.php
r3398580 r3398651 4 4 Plugin URI: https://www.infility.cn/ 5 5 Description: Infility公共插件 6 Version: 2.14.3 16 Version: 2.14.32 7 7 Author: Infility 8 8 Author URI: https://www.infility.cn/ … … 138 138 function __construct() 139 139 { 140 define( 'INFILITY_GLOBAL_VERSION', '2.14.3 1' );140 define( 'INFILITY_GLOBAL_VERSION', '2.14.32' ); 141 141 define( 'INFILITY_GLOBAL_PATH', plugin_dir_path( __FILE__ ) ); // fullpath/wp-content/plugins/infility-global/ // 有斜杠 142 142 define( 'INFILITY_GLOBAL_URL', plugins_url( '/', __FILE__ ) ); // https://the_domain/wp-content/plugins/infility-global/ // 斜杠是自己加的 -
infility-global/trunk/widgets/infility-import-data/include/infility-import-seo.php
r3398580 r3398651 244 244 $updated_keys[] = '_aioseop_description'; 245 245 $updated_keys[] = '_aioseo_description'; 246 } 247 248 // 标记为过期并清理缓存,确保前端/管理端读取到最新数据 249 if (function_exists('YoastSEO')) { 250 self::mark_yoast_indexable_stale((int)$post_id, 'post'); 251 } 252 if (function_exists('clean_post_cache')) { 253 clean_post_cache((int)$post_id); 246 254 } 247 255 … … 367 375 } 368 376 377 // 标记为过期并清理缓存,确保前端/管理端读取到最新数据 378 if (function_exists('YoastSEO')) { 379 self::mark_yoast_indexable_stale((int)$term_id, 'term'); 380 } 381 if (function_exists('clean_term_cache')) { 382 clean_term_cache([(int)$term_id], (string)$taxonomy); 383 } 384 369 385 return $updated_keys; 386 } 387 388 /** 389 * 标记 Yoast Indexable 为过期(version=0),以便后续重建索引。 390 * @param int $object_id 文章ID或分类ID 391 * @param string $object_type 'post' 或 'term' 392 * @return bool 是否标记成功 393 */ 394 public static function mark_yoast_indexable_stale($object_id, $object_type = 'post') { 395 $object_id = (int) $object_id; 396 $object_type = ($object_type === 'term') ? 'term' : 'post'; 397 398 try { 399 if (!function_exists('YoastSEO')) { 400 return false; 401 } 402 403 $repo = \YoastSEO()->classes->get(\Yoast\WP\SEO\Repositories\Indexable_Repository::class); 404 if (!$repo) { 405 return false; 406 } 407 408 $indexable = $repo->find_by_id_and_type($object_id, $object_type); 409 if ($indexable instanceof \Yoast\WP\SEO\Models\Indexable) { 410 $indexable->version = 0; 411 $indexable->save(); 412 return true; 413 } 414 } catch (\Throwable $e) { 415 // 忽略异常,返回失败以避免中断导入流程 416 } 417 418 return false; 370 419 } 371 420 … … 384 433 'errors' => [], 385 434 'samples' => [], 435 'not_found_arr' => [], 386 436 ]; 387 437 … … 427 477 if ($address === '') { 428 478 $summary['not_found']++; 479 $summary['not_found_arr'][] = $address; 429 480 continue; 430 481 } … … 480 531 481 532 $summary['not_found']++; 533 $summary['not_found_arr'][] = $address; 482 534 } 483 535 } catch (Throwable $e) { … … 505 557 } 506 558 559 if(!empty($summary['not_found_arr'])){ 560 $message[] = '<p>没匹配到的链接:</p>'; 561 foreach ($summary['not_found_arr'] as $s) { 562 $message[] = '<p>- ' . esc_html($s) . '</p>'; 563 } 564 } 565 507 566 return $message; 508 567 // error_log('[Infility SEO Import] ' . implode(' | ', $message));
Note: See TracChangeset
for help on using the changeset viewer.