fix(user): show IP city on home/center and force /user + profile templates

This commit is contained in:
kate522 committed 2026-07-25 15:02:57 +08:00
1 parent ac7ff8d4f2
commit 820fafd8a7
6 files changed
+163 -49

No files matched your search

+10 -2
View File
@@ -488,8 +488,16 @@ function aksrt_ensure_template_page(string $key): void {
$cfg = $_aksrt_special_templates[$key];
$desired_slug = sanitize_title($cfg['slug'] ?? $key);
// 已有页面使用此模板?
if (aksrt_find_template_page($cfg['file'])) return;
// 已有页面使用此模板?仍校验模板 meta,避免空白默认页。
$found_page = aksrt_find_template_page($cfg['file']);
if ($found_page instanceof WP_Post) {
$current_tpl = get_post_meta((int) $found_page->ID, '_wp_page_template', true);
if ($current_tpl !== $cfg['file']) {
update_post_meta((int) $found_page->ID, '_wp_page_template', $cfg['file']);
aksrt_clear_template_page_cache();
}
return;
}
if ($desired_slug !== '') {
$existing_page = get_page_by_path($desired_slug, OBJECT, 'page');