Support

Account

Home Forums General Issues Show post id's field in backend…

Solving

Show post id's field in backend…

  • 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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.