Post type field is not empty when cloned

Support General Post type field is not empty when cloned

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #47828
    philphil
    Participant

    Using the following code to create a clonable 'Post' field which is select_advanced:

    add_filter('rwmb_meta_boxes', function($meta_boxes) {
    	
    	$meta_boxes[] = array(
    		'id' => 'metabox_id',
    		'title' => 'Metabox Title',
    		'context' => 'normal',
    		'fields' => array(
    			array(
    				'name' => 'Select a Post',
    				'id' => 'select_a_post',
    				'type' => 'post',
    				'post_type' => 'cpt_name',
    				'field_type' => 'select_advanced',
    				'multiple' => true,
    				'clone' => true,
    			),
    		),
    	);
    	
    	return $meta_boxes;
    	
    });

    When the "+ Add more" button is clicked, the field is prefilled with the latest cpt of that type - https://imgur.com/a/lzurPEZ

    I would like the field to be empty when cloned. How can I do this?

    I am using the default TwentySixteen theme and no other plugins are active other than Classic Editor.

    Metabox version 5.10.8
    WP version 6.7.2

    #47830
    PeterPeter
    Moderator

    Hello Phil,

    Thank you for your feedback.

    This issue has been escalated to the development team. We will work on this to fix the issue as soon as possible. In the meantime, you can disable the option 'multiple' => true to remove the pre-select option for the cloneable entry.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.