您可以使用the_title
hook 要在管理中更改帖子的标题,请执行以下操作
add_filter( \'the_title\', \'custom_post_title\', 10, 2 );
function custom_post_title( $title, $post_id ) {
// Return early if not in the admin
if ( !is_admin() )
return $title;
$post_type = get_post_type( $post_id );
// You only need to change the title for pages
if ( \'page\' !== $post_type )
return $title;
$custom_title = get_field( \'your_custom_title_acf_key\', $post_id );
// If custom title is present, display it instead of original
if ( $custom_title ) {
$title = $custom_title;
}
return $title;
}