微言标题改为 微言-时间戳

This commit is contained in:
2026-05-05 01:00:16 +08:00
parent c595e23ed5
commit bbc55ccaee
+1 -2
View File
@@ -378,8 +378,7 @@ function kjweji_customize_register($wp_customize) {
// tucao 自动生成标题 // tucao 自动生成标题
add_filter('wp_insert_post_data', function($data) { add_filter('wp_insert_post_data', function($data) {
if ($data['post_type'] === 'tucao' && empty($data['post_title'])) { if ($data['post_type'] === 'tucao' && empty($data['post_title'])) {
$content = wp_strip_all_tags($data['post_content'] ?? ''); $data['post_title'] = '微言-' . time();
$data['post_title'] = mb_substr($content ?: '微言', 0, 30);
} }
return $data; return $data;
}); });