微言自动生成标题 + 操作手册优化

This commit is contained in:
2026-05-05 00:57:59 +08:00
parent 4d4f622c83
commit c595e23ed5
2 changed files with 247 additions and 0 deletions
+9
View File
@@ -374,3 +374,12 @@ function kjweji_customize_register($wp_customize) {
'type' => 'text',
));
}
// tucao 自动生成标题
add_filter('wp_insert_post_data', function($data) {
if ($data['post_type'] === 'tucao' && empty($data['post_title'])) {
$content = wp_strip_all_tags($data['post_content'] ?? '');
$data['post_title'] = mb_substr($content ?: '微言', 0, 30);
}
return $data;
});