自動輸入預設標題,以輸出「時間」為例。
Is it possible to auto fill the WordPress title field with today’s date?
benlumley
略作修改,將來源裡使用的date()
更改為wp_date()
,確保時區與部落格一致。
add_filter('default_title', function ($title) {
global $post_type;
if ('post' == $post_type) {
return wp_date('[Y-m-d H:i]');
}
return $title;
});
效果:[1970-01-01 24:00]