Assuming the $value
actually returns a post’s ID. Replace the code
wp_add_post_tags( $post_id, $value );
With
wp_add_post_tags( $post_id, sanitize_title( get_the_title( $value[0] ) ) );
Related Posts:
- clients list using wordpress
- echo value from ‘select’ field type into page template using cmb2?
- Find callback function for custom taxonomy metabox
- Detect meta value changes when post is updated (post_updated)
- Search everything (posts, pages, tags, cpt, meta)
- Search Custom Post Type with all meta attached?
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Exclude Custom Post Type & Pages From Auto-Tag Function
- Saving multiple Metabox contents
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- Create a post in custom post type using field in registration form after users submit form
- Copy custom field value to post title
- search also in taxonomy, tags and custom fields
- get_post_meta not working on publishing
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Cannot save CPT meta box
- Cross reference custom post types
- Warning: Invalid argument supplied for foreach() [closed]
- ACF in wordpress
- How to inherit field value from parent post into in child / sub post
- Custom post type in Custom widget – $listItem
- Custom posts – tag pagination
- Let users upload image(s) to the post from front end
- Excerpt length: get first paragraph
- display custom portfolio tags
- Custom Form / Search with Custom Post Type Data
- CPT tags not showing when editing post
- Problem with multi checkboxes value in metabox?
- Populate custom post type/custom fields from an external database
- Custom Field to post_title
- Function not pulling image or text from custom post type
- I want to split this into two functions
- Allow authors to create article image
- How to display *block number* instead *date value* on WordPress posts?
- How to Add Custom Fields to a Custom Post Type?
- How to use a custom post type archive as front page?
- Set posts of a custom post type to be private by default?
- Load custom posts with same tag as page
- Custom Taxonomy Template Post List with Sort Order
- Display Custom Post Type Fields
- How can I add dropdown widget/box to admin post page?
- Get posts with tag all post types
- WordPress query by multiple Custom fields and order by date
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- Bulk edit custom excerpt text in WordPress
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Getting a “Changes you made will be lost” dialog prompt on a custom post type page
- Frontend posting – everything saves other than checkboxes?
- Search Custom Post Type Custom Fields
- handling csv data with a custom post type
- GravityForm: Populate Dropdown with custom post type [closed]
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- Problem fields custom date, time, and checkbox
- WooCommerce product search titles only
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- Group posts by custom post type
- Sorting custom post type columns with external data and without meta values
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Change CPT archive title
- I need to add endpoint for wordpress categories
- WordPress Custom Fields Won’t Save
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Meta Query Not Returning Output Despite Having Matching Values
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Displaying custom field according to date
- Custom fields for custom post type
- Custom post type isn’t working
- Add additional field to custom post_type
- custom post for slider
- Strip Characters From Tag Name
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- Displaying custom fields for custom post type generate with Custom Post Type UI Plugin
- 404 Page Not Found on /Page/2/ on Tag Page
- Best way to create a search for custom post type by custom field values
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Display Posts Query with IF function
- Custom PT, Taxonomys and wordpress query
- How can i loop through custom post type according to custom meta field?
- How to use get_post_custom_values to return the value of an array
- new post-type how do i retain the plugins on my sidebar?
- Custom Post Type Dashboard Tab not displaying any posts
- Title and URL Error in Breadcrumb Navigation for Custom Post Types
- Assigning categories to custom post types via a front-end form; only works for native post type
- How to set “section categories”?
- Show Post columns to specific users on condition
- Custom permalink rewrite rules – how do I fix this?
- Create Inclusions and exclusions
- Retrieving custom post type fields without a post
- pre_get_posts with multiple post types AND a meta_key
- Search form to find custom meta box generated data
- Custom Info Box at end of posts?
- Show Custom Post Type taxonomy term that matches custom field
- Query Distinct Taxonomies of Custom Post Type
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Comments are not working on Custom Post Type
- Display ACF object field data using Elementor Custom Query
- Sortable admin columns ordering from custom fields isn’t combine com search and Dropdown filter
- WordPress custom field sorting, weird behavior: the latest post is at the end
- I want to understand plugin implementation of custom posts / taxonomies / metaboxes
- Is it possible to use a post name in a custom post slug?