You’re on the right track.
When you do something like this in a form..
<input name="tax_input[formats][]" />
You create levels in the $_POST
array.
So you’d get the formats array like this…
<?php
$formats = $_POST['tax_input']['formats'];
Full example…
<?php
add_action('save_post', 'wpse74017_save');
function wpse74017_save($post_id)
{
// check nonces and capabilities here.
// use a ternary statement to make sure the input is actually set
// remember that `save_post` fires on every post save (any post type).
$formats = isset($_POST['tax_input']['formats']) ? $_POST['tax_input']['formats'] : array();
// do stuff with $formats
}
Related Posts:
- Why does publish_{custom-post-type} fire on update?
- Visual Studio SignTool.exe Not Found
- How can I set a draft page as parent without publishing?
- Display a post’s publish date from 2112
- Does blocking xmlrpc.php affect pinging update services like pingomatic
- I can’t preview post’s change once they are published
- Publish post when edit post form submitted with enter/return pressed on keyboard
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Check before publishing, if already exist post with current custom field value
- How to make scheduled post preview visible to anyone?
- Scheduled Posts and wp-cron – Why don’t scheduled posts publish if too old?
- Returning ACF custom field from publish_post
- Show recent published posts
- How can you receive the most recent permalink or terms of the newly saved post?
- Is there a way to know if a post has been published through XML-RPC?
- How to unpublish a page and still keep a draft?
- Save and Publish button not working after installing SSL
- publish_post conflicts with save_post
- post_status => publish not working
- Disable “preview changes” button
- Can we have private drafts?
- Set post terms on post publish
- save imported posts as drafts
- Update post meta on bulk edit / update
- Can’t schedule post for another time
- publish_post called too early
- Custom save button shows ‘Are you sure you want to…’ dialog
- Get publish post link?
- Controlled publishing in WordPress
- Change the text of the publish button to Save
- problem with publish date not always appearing [duplicate]
- Remove a category from a post when saving a new post
- What is happening to make my Update/Publish button disabled?
- detect when a custom post is cretaed for the first time
- WordPress publish_post hook not getting featured image and meta on first publish, but works on updating title
- What is the reason for the new_to_publish hook not working?
- After I publish a post where does it go
- Dynamically set taxonomy term and show admin notice on post save
- Should you manually ping new WordPress posts?
- Authors should not publish
- How to add custom status to quick edit
- I need to modify drafts using custom data from database and then publish it
- How to show or hide a post based on meta_value selection?
- i am making text changes on my page show in preview not on live site, why? [closed]
- Is WordPress “publish” atomic?
- How to move post process to background
- How does redirect work when publish date changes and date in url changes?
- Use value from ACF to populate other fields
- Gutenberg publish date datepicker
- How Google Indexer should only index published pages
- generate random slug when adding taxonomy
- Publish and go to page [duplicate]
- Publish Post Action Not Working
- Is it normal for a scheduled post to say “Missed Schedule”
- Manage multiple wordpress installs (Best Practice)
- Showing the next post’s title, even if it’s an unpublished post
- Force Publish Future (Scheduled) Posts Immediately [duplicate]
- Can’t publish posts, Jetpack won’t connect, empty notification emails to my inbox [closed]
- Duplicate post on publish
- get_the_terms inside save_post gives old terms
- How is it possible to use a very reduced version of WordPress?
- Taxonomy Child Not Updating Unless I Click Update Twice
- Problems in updating a self-developed plugin
- How to use wp_set_object_terms depending on page ID?
- When i save or publish a post setting reset wp
- Why does my custom slug only show in Gutenberg editor after page refresh?
- Is There a Difference Between Taxonomies and Categories?
- How to show a hierarchical terms list?
- Show all terms of a custom taxonomy?
- How to get a taxonomy term name by the slug?
- Why does save_post action fire when creating a new post?
- Explanation of update_post_(meta/term)_cache
- what is correct way to hook when update post
- Add validation and error handling when saving custom fields?
- get_posts assigned to a specific custom taxonomy term, and not the term’s children
- How can I get only parent terms?
- Using save_post to replace the post’s title
- Check for update vs new post on save_post action
- Passing error/warning messages from a meta box to “admin_notices”
- get_terms by custom post type
- Need a simple but complete example of adding metabox to taxonomy
- Prevent post from being published if custom fields not filled
- Retrieve posts by term id custom query
- How to avoid infinite loop in save_post callback
- Get terms by taxonomy AND post_type
- Change order of Custom Taxonomy List
- Get the the top-level parent of a custom taxonomy term
- get_the_term_list without links in 3.1
- Inserting terms in an Hierarchical Taxonomy
- get_terms – only top level
- What is ‘term_group’ for ‘order_by’ in get_terms()?
- Get Posts by Custom Post Type ,Taxonomy, and Term
- Get The Post Type A Taxonomy Is Attached To
- How can I delay the publishing of a page or post?
- How to only list the child terms of a taxonomy and not their parents?
- Is there a downside of using wp_defer_term_counting?
- Metabox with checkbox is not updating
- Check if a post is in any child category of a parent category
- How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms