You can store an array in a custom field; WordPress serializes it for you on save and unserializes it on get.
Name your fields with a pseudo array syntax:
<input name="mycustomfield">
<input name="mycustomfield[date]">
You’ll get a $_POST
array:
mycustomfield = array ( 'audio' => 'somevalue', 'date' => 'somedate' )
Now you can do whatever you want with it.
Drawback: Meta queries against serialized arrays are hard. Multiple post meta field are much easier to handle.
Related Posts:
- Custom post meta field effect on the performance on the post
- Difference between meta keys with _ and without _ [duplicate]
- Having different sidebar content for MANY pages?
- Add custom objects/entities to WordPress
- How can I fetch CSS from JSON WP REST API response
- How to set a default meta value for custom field
- How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?
- Plugins won’t recognize my plugin’s hidden custom fields
- Store JSON in a custom field
- Calling Specific Pages with wp query Part II
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- If value present, order posts by two consecutive custom fields
- Copying Custom Meta Values from existing post to a duplicate post
- Save page data to an xml file
- List posts with common custom field value
- Create Posts using Import>RSS/WXR/XML and pass values to Custom Fields
- Best way to add custom / magic / flutter fields into RSS feed
- Setting orderby to a custom field using pre_get_posts
- Importing users to Buddypress with custom fields
- How to save a ToggleControl value in a meta field?
- How to get multiple checkboxes in one meta field
- Adding Custom Fields to Search
- How to Display Custom Meta Box only on Specific Page IDs
- How to get customfield value by woocommerce product ID
- How do I get the url slug inside the dashboard for a custom post type?
- How do I use Ajax to build a dropdown of custom fields based on a post selected in previous dropdown?
- Register rest field for specific user
- Custom Field Suite A little problem
- Audio player shortcode not showing up when using variable
- Save the_content into custom field
- How make a custom search on backend in WordPress without plugin?
- get_posts that haven’t been assigned a specific custom field
- Custom Fields box in the post editor: Replace textareas with input elements
- Hide custom meta data if empty
- Woocommerce Product Custom Select List (not variation)
- Passing args to WP_User_Query am I using meta correctly?
- How to find a post using XML-RPC without knowing ID
- How to get latest post value if first post is empty in wordpress
- Custom fields attached to a page template only show on edit screen when page is saved
- Value from custom field is not being displayed?
- Can I access a post meta field before the loop?
- wrap text around custom fields array
- Displaying page image in the footer automatically
- Hide custom column in admin template screen (Elementor) [closed]
- ORDER BY custom field value out of where clause
- Show image if author meta (profile fields) exists outside loop
- How can i retrive a text from a custom field
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- Is it possible to populate a custom field with content from a page
- Buik update custom field values from external API
- award points to a user each time they update their cpt post
- TinyMCE custom button retrieve value from custom field
- Save all custom field data into one “master” custom field
- Update post meta data (custom field) by post link
- Change a custom field value after X number of seconds
- How to put forward a blog post
- Changing order in which custom fields appear in dashboard
- Let Users Filter Posts by Custom Fields
- Run Function if Order Meta Exists – WooCommerce
- Jquery on custom-field backend
- Display latest post depending on Meta Box content
- Custom fields won’t update
- Replacing custom field with shortcode
- WPAlchemy issue when using 2 select menus with the same values inside a repeating group
- How to use custom fields like Title to show value in content?
- Populate custom checkout fields with data from previous orders
- Expire Date Condition not Working ACF WordPress
- Making custom meta box required (with error message if not filled in) on Gutenberg
- Is the use of many custom field not good for server?
- Changing form action based on selected value
- trying to add extra field using hooks
- Can’t set custom meta fields for a post
- Very large list of options for BuddyPress profile fields
- Hiding Dropdown Fields
- Can you generate a featured image from two images from custom fields?
- Change Order of Sections Using Custom Fields
- How to add content with a filter when there’s no content in the editor
- Text in header as a page – hide from Web crawlers
- When post is updated, custom metadata in text area field is overwritten
- Order a query by meta_value and then by post_date
- custom field functionality
- Fetch data from a WP page with same name as current username
- Getting content from custom fields of different pages on a single page
- Custom Fields – How can I remove the publish option for certain users
- Can i categorise my meta box?
- How to overwrite a value for a custom field?
- WordPress archives by custom field and date
- Decouple page name from page title
- Custom Field add markup to line breaks
- When editing a post with a custom meta box the values aren’t displaying correctly
- Function to retrieve a picture if there is no picture is attached
- Show posts containing or not custom field
- Use Metabox to enter Post Title
- Include custom fields into the content of a regular page
- add_post_meta insert null value into Database
- Extract array from custom field
- extra post fields for url + youtube video / implementation
- i want to send email on custom post field (job_status == 2) but it is not working
- How to create a searchable database with a single-field search box at the front end? [closed]
- Archive for custom fields?