微言标题改为 微言-时间戳
This commit is contained in:
+1
-2
@@ -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;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user