Hello,
I want to display a search field in the admin backend that shows post id as a result.
I found this code in the acf forum
function action_function_name( $field ) {
if( $field['value'] ){
$thepost = get_post($field['value']);
echo '<p>'. $thepost->post_title .'</p>';
}
}
add_action( 'acf/render_field/type=post_object', 'action_function_name', 20, 1 );
I added it to functions.php and it works well since it shows the title of the selected post. Is it possible please to show the post id ?
My goal is to let my authors search for a post by name and the result is the title and the id (in the backend)
I’m Using “Objet Article” field
Screenshot : https://prnt.sc/uy985f
Please advise,
Thank you