I have rethought the problem:
Finally, I resolve it with save_post hook:
function enhanced_portfolio_categories_save_post(){
$terminos = array();
foreach ($_POST['my_categories'] as $key) {
$custom_tax = get_term_by('term_id', $key, 'portfolio_categories');
array_push($terminos, $custom_tax->term_id);
}
wp_set_object_terms( $_POST['post_ID'], $terminos, 'portfolio_categories');
}
Related Posts:
- Automatically exclude categories from metabox based on title
- Only one category per post
- Is there an easy way to make a meta box have the tabs like the Categories meta box has?
- Gutenberg editor add a custom category as wrapper for custom blocks
- How to display non-hierarchical taxonomy as terms with checkboxes?
- How can I hide a category from Contributors in the edit/add new post screen?
- WordPress Multiple Category Search
- How do the ‘tag’ and ‘category’ (default) taxonomies do ‘save_post’ action?
- How to remove categories filter from wordpress admin?
- Decreasing the Memory Consumption of a WordPress Site?
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive
- How can I select a primary category?
- how to use a different domain/subdomain for authors/catagories on single site?
- Deleting default category in wordpress
- Delete a specific category when deleting a user
- Changing Top Level Items into Radio Buttons in the Categories Meta Box?
- Admin Panel – Disable Moving Selected Terms To Top of Metabox
- How to list child categories in custom category template?
- Trash bin for categories
- How to Make a Categories Meta Box with Hierarchical Checkboxes on Frontend?
- Add search to list of categories in post editor
- Need help adding custom field to category
- How to set up sub-categories for author pages?
- View category in the preview of Theme Customizer
- Add default content to post (for specific category)
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Block multiple categories from Blog
- How to have a static category/author page?
- Create single.php for specific category by category id
- Show posts of one category only with Custom Taxonomy on single.php
- Select category in custom query
- Remove “Parent” Selection When Adding/Editing Categories?
- Category Search functionality on category metabox (wordpress admin)
- WP 3.0.5: Best way to add custom metaboxes for post categories?
- Order Taxonomy Term by date created
- Render Selected Categories in Admin Edit Post Screen differently
- Apply custom category template to subcategories
- Hide post meta data on a specific category
- Format Brand value in Category view [closed]
- Add custom taxonomy under the category title
- How to show in search results posts with a particular tag in a particular category?
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- Remove ‘rel’ attributes from the_category() output
- Multiple menu items highlighted
- Want to hide some categories from the categories meta box in the post editor for the two specific user roles
- How to remove the “+Add Category” button from the Category metabox?
- in_category() works in single.php but not in page.php?
- How to customize tag and category post listings to show introductory content?
- Use a wordpress page to display a certain category
- How to view WordPress’ default category IDs?
- Multiple Category Search
- How do I add a function on a specific post category?
- How to customize category template?
- Category-slug.php not being used
- How would I go about adding custom header images per category?
- Display category description instead of “nothing found” page
- Category pie diagram meta box in post editing page
- Limit a meta box to a specific category
- Display posts separated by Category in Author’s page
- How to categorize posts under Category 1 and Category 2 which are separate lists of categories, and display them as separate lists in widgets
- How to organize custom categories for filtering and selecting
- Filtering *out* a taxonomy from the admin post list
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Use Tag input metabox style for Categories
- How to rewrite the post URL according to the category?
- How to build a simple nav system of custom post type categories and its posts?
- Display thumbnails for certain category posts
- Keyword search in multiple categories
- Is it possible to remove from default category widget?
- How to customize my category pages
- How to make the ‘delete’ button inactive on some categories?
- Two columns in homepage each with one category
- How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?
- Custom Meta Box (SELECT2) Not Saving Taxonomy Terms
- Multiple selection for wordpress widget
- Different CSS class by category
- how to nest specific category thumbnails inside different containers
- Wrong category nice name is displayed on archive page
- How can i change what one category displays?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- How to let the user create a selection of categories via the backend
- Theme for subcategories
- How to restrict the amount of categories/post tags/terms for a post type post
- Custom meta boxes ID prefix showing on first category but not others
- Add code to header based on category for specific posts?
- Custom css per category and per single post belong in each category
- How to hide widget from certain category
- custom query for both category and pages using global $wpdb;
- I would like to feature a tip on the homepage
- How to add icon over specific thumb
- Problem with Custom Post Type Categories
- List post only under the category, exclude child category content
- SQL query to get posts from multiple categories but not in a category
- Filter categories/tags to display in multiple metaboxes for selection in back-end
- wp_delete_term or wp_delete_category?
- Select posts that match multiple category names, must match all categories listed
- Custom Portfolio Page
- WP Category Meta plugin fix? [closed]
- Last x Posted Categories?