Agreed, I’ve seen it too, but I don’t think there’s any readily available API or method.
For me, I use a lick of jQuery;
<input type="text" class="list-item" name="list_items[]" />
<input type="button" class="button-secondary" id="add-list" />
<script type="text/javascript">
( function( $ ) {
$( '#add-list' ).click( function() {
var $item = $( '.list-item:last' ), $new = $item.clone();
$item.after( $new.val( '' ) );
}
})( jQuery );
</script>
Note that you might wanna tweak those selectors if you plan on having multiple ‘instances’ of these.
Related Posts:
- How can I put a custom meta box above the editor but below the title section on the edit post page?
- Making custom meta box required (with error message if not filled in) on Gutenberg
- HTML for adding a meta box (basic text field) to page editor?
- Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?
- Custom field/meta populated by dropdown of existing posts?
- What is the index [0] for on post meta fields?
- How to add tab which is visible only in admin side of product in woocommerce? [closed]
- Individual Widgets per Page
- Gutenberg add a custom metabox to default blocks
- ‘Preview Changes’ for custom meta boxes?
- Using TinyMce with textareas in meta boxes on custom post types
- add meta box – custom field : which to choose?
- How do I position meta_box on post edit screen after the title?
- Tabindex on text input immediately after WordPress title input
- Add metabox to document tab in gutenberg
- How to add add_meta_box to specific Page Template?
- Custom field metabox not showing in back-end
- Custom Post Type – Taxonomy Dropdown Menu?
- Put the media uploader in a metabox
- How can I add a column/s to wp_posts table?
- How to hide meta box values from custom fields list?
- How to group meta boxes on the post edit page
- Adding another state (spam, reject, approve) to wordpress comments?
- echo value from ‘select’ field type into page template using cmb2?
- Disable the visibility options in WP
- Arrange custom fields with drag and drop?
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- Unable to get Preview of Uploaded image within a Custom Meta box
- Using media-upload.php to upload mp3 via custom fields
- extend Meta Box / Document Panel
- Save metabox with multiple checkbox array
- Add custom option to Standard Page Attributes Meta Box
- How to store the value of a custom field dropdown select for post referencing?
- How to get custom metabox image field?
- Add multiple images to a page sidebar
- Only show metabox when date-value in other metabox is over?
- Add search to list of categories in post editor
- Need help adding custom field to category
- Detect meta value changes when post is updated (post_updated)
- Custom Meta Boxes: Store two values in one repeatable field
- How to create Image gallery Metabox in wordpress [closed]
- Custom field being erased after autosave
- How to replace default icon on “Add Media” button?
- Order custom posts by a date metabox
- How to select one major category (or custom taxonomy) for a custom post type?
- How to sort CPT by custom meta value (date), and return posts month by month
- Populating meta box with select-list of existing posts, and assigning it to custom post types
- Create meta boxes that don’t show in custom fields
- How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?
- Add custom meta box on Post page
- Adding a Nav menu to post admin
- Use Custom Post Type as Custom Field
- How to load php file for specific page in admin?
- How to set default metaboxes on user creation?
- Saving multiple Metabox contents
- meta_box or custom_field as a second tinymce post-instance?
- Metabox nonce PHP notice
- TinyMCE in Custom Metabox not loaded after upgrading from WP 3.1.4 to WP 3.2
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- Why could I not change the icon of the default Add media button that I added into the toolbar of TinyMCE?
- wp_editor in add_meta_boxes does not show gallery
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- Problem in custom meta boxes
- Metabox saving values
- Create A Metabox For A Custom Field
- add_meta_box: Datepicker like the one for postdate?
- Multiplile values checkbox or select in custom meta box
- Create custom field key upon theme activation
- Problem with adding exta field in metabox in custom post type
- Displaying Meta Box Image
- Automatically assign taxonomy term if custom meta value exists
- Adding a custom field or metabox to the post-thumbnail widget?
- Multiple information using custom post type
- Consolidate Metaboxes into 1 Big Metabox
- Custom fields to save multiple values
- how to set default value for checkbox in wordpress
- How do I add custom_meta_box_id’s value?
- Undefined index error when saving content on metabox
- How WordPress autosave can save plugin fields?
- How to save multiple metaboxes?
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Metabox with multiple fields added by user and upload box
- add meta box using function.php
- Metabox image upload and custom field
- Using WPAlchemy metabox values in another metabox
- How can I filter the contents of a metafield before it’s displayed in the admin?
- can’t see all pages in dashboard (can only see 3) /wp-admin/edit.php > 500 error
- Display custom post on home page based on a metabox selection
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- WordPress Post Editor Toolbar Missing
- How to add “Check all” to Edit post page in WP?
- My metabox class
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- How to construct multiple meta boxes
- Best choice of options/settings framework for plugin/theme development
- Loading scripts to the Post Edit page only
- Force hide custom field metaboxes
- How do I disable wpautop for a specific block?
- wp_editor() usage in custom meta box
- Security checking in meta_box save is reluctant?