You would use these functions for adding meta:
add_user_meta
adds user metaadd_post_meta
adds post meta
Notice that wp_insert_post
will also return the post ID of the post created ( or a WP_Error object if it failed ). You can then use that in add_post_meta
. See https://developer.wordpress.org/reference/functions/wp_insert_post/
Note though that tags/categories are not meta, they are taxonomies with terms, and use separate tables and functions for performance reasons.
Related Posts:
- Load custom posts with same tag as page
- Categories and Tags not working!
- Search doesn’t find tags or categories in custom post types
- Set a default category – if the user didn’t select one- before creating a post
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Group posts by custom post type
- Custom post type getting wrong categories and tags
- How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?
- Cross reference custom post types
- How can I show 1 featured post in a styled element, and the next few below differently styled
- Categorise Custom Post Types
- Tag page only display 10 posts
- Meta data (Tags and Categories) for Custom Posts not showing.
- Why does my taxonomy have a category style div id?
- Need help deciding on a taxonomy
- Get Posts by Category, Tag , and CPT Taxonomy
- The Difference Between Categories and Tags and Taxonomies and Terms
- Custom post type, taxonomy and admin bar
- Advanced archive url structure (category, tag and date)
- get taxonomies from terms
- How to set “section categories”?
- Do not output category and tag URLs
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Custom Post Type – Admin Columns
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How to hook into the CPT’s title placeholder?
- post_tag taxonomy with custom post type
- category__in not working on custom post type
- how do I group content in magazine-style ‘issues’?
- Use standard WordPress categories with a CPT
- remove_action conditionally for Custom Post Type
- How can I add single catogory for custom post type?
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- automatically save custom post type title as a category
- Remove “Get Shortlink” button in admin of custom post type
- get_categories() for only CPT
- category.php displays ALL posts instead of just those with the current category
- Display Next/Prev when looping Custom post-types archive?
- Possible for Category Base and Custom post Type to share the same slug/permalink?
- Weird problem happening with custom taxonmy when creating/updating posts
- Does anyone have a plugin that could automatically tag custom post types in wordpress?
- How to detect filter in URL in Category page?
- CPT Archive with core Category
- Validate custom fields before save using WordPress Rest API
- Replace li Items with divs with classes
- showing custom post types of a certain category only
- get_posts() with custom post type does not work outside page.php
- Custom post types and tag archive pages/permalink structure issue
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Show a Category X’s custom post type on Category X archive page?
- Multiple level category drop-down from the WordPress dashboard
- How to get categories linked in posts for a specific post type
- How to edit this code to get the categories in achieve page?
- Get the category from custom post type
- How to create a gallery page with categories?
- Make a custom_post translatable
- Create new custom post and post category of same name
- data-type=”” … needed post tags stripped of characters
- Use remove_meta_box conditionally on custom post type
- How do I amend form data before it is saved for a custom post type
- How to list tags from custom post type attachments?
- Custom Post Type Category URL
- Custom Post Type Categories URL not displaying posts
- WP Query results showing posts outside of category ID
- Print all the tags from a custom post type
- Better approach for a WordPress Inventory
- Showing all posts and custom post types by using one category
- Default post_tag for custom post type
- Custom posts – tag pagination
- How to properly use Categories with Custom Post Types
- Custom post type category permalinks and archive pages
- One post auto attached to many another items
- Navigate by Tags inside a custom Post Type
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- Display custom post types by category
- Searching in multiple category + URL hierarchy in real estate WordPress site
- Search CPT by tag ids
- Category permalinks don’t work even after flushing
- How to sort post category using its Description
- Custom WordPress theme not displaying posts from category
- Wanting to list all Post types under a common category
- How to show posts of the same category on a page?
- Hook create / update post
- call a function when insert and update a custom post type
- How To Display Category list from Portfolio post type plugin?
- Custom Post Type tag taxonomy “Page Not Found”
- do action inside a class is not working
- Dropdown switching subcategories portfolio
- Custom Post type archives / categories give 404
- Filter custom post type by tags
- Problem to show custom post type in archive page category wise
- Category / Custom Post Type permalink issue
- Categories in custom post types
- Sorting custom post types by category?
- Categories and page filtering with pre_get_posts
- Select Category as Page Parent
- Change CPT Edit Target Link for Admin List
- Custom post type category pages pagination returns 404
- Pull total post count for child category and parent if term ID