metabox – Multiple posts selection

Question

I have this codesnippet for metabox , I want to have multiple posts selection
This is the code that I have for one post selection by custom post type ;
If anyone has an idea ?

The code needed to be modified is in fields .

Thanks in advance

if ( ! function_exists( 'trav_register_acc_meta_boxes' ) ) {
    function trav_register_acc_meta_boxes() {
        $meta_boxes = array();

        //room meta boxes
        $prefix = 'trav_room_';
        $meta_boxes[] = array(
            'id' => 'room_details',
            'title' => __( 'Room Details', 'trav' ),
            'pages' => array( 'room_type' ),
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                array(
                    'name'  => __( 'Accommodation', 'trav' ),
                    'id'      => "{$prefix}accommodation",
                    'type'  => 'post',
                    'std' => isset($_GET['acc_id']) ? sanitize_text_field( $_GET['acc_id'] ) : '',
                    'post_type' => 'accommodation',
                ),

0
Ahmed C 1 month 2022-10-30T08:50:41-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse