我自动创建自定义帖子类型“produktionsauftrag”的标题。我的函数中的脚本。php可以工作,但我无法在我的标题末尾找到帖子。
过滤我的函数。php文件:
add_filter(\'wp_insert_post_data\',\'update_pa_title\',99,2);
function update_pa_title($data, $postarr) {
global $post;
if ( !is_admin() )
return $data;
if ($data[\'post_type\'] == \'produktionsauftrag\') {
$data[\'post_title\'] = \'Produktionsauftrag - \' . $post_id;
return $data;
} else {
return $data;
}
}