Referenced from https://codex.wordpress.org/Post_Status_Transitions#.7Bstatus.7D_.7Bpost_type.7D_Hook the hook named “{status}_{post_type} Hook”. This hooks is fired, when custom post type “community” is giving the status “publish” = is published. Hook will give post_id and post object as parameters to the callback function. And wp_set_post_terms, requires first parameter as post ID.
This should work:
add_action('publish_community', 'community_post_type_tagging', 10, 2);
function community_post_type_tagging($post_id, $post){
wp_set_post_terms( $post_id, 'community', 'post_tag', true )
}
Related Posts:
- alt attributes not showing on pages
- using get_the_category to get all post categories except one
- Echo tags with an if statement and display php inside of the IF?
- Detect tag page and include an Image for that specific tag
- Show all tags NOT applied to post
- showing tag beside catagory
- Conditional tag for attachment posts
- Order tags, but not alphabetically
- How do I display a tag cloud under my post that only shows tags from that post?
- how can I use WP_Query to exclude a specific tag.?
- not functioning
- Best way to show map of tagged posts?
- Remove a particular tag name from the tagcloud
- How do I change the output of get_the_tag_list()?
- How to remove Tags: text from the_tags?
- What are allowedposttags and allowedtags?
- List ‘n’ number of posts from a Tag, each with a different class or ID
- When are tags counted? Can it be trigered manually?
- display tag slug as class per link in tag cloud
- How to add class on term link?
- Change the color of post title on specific tags
- How to use meta data for each tag cloud a
- Exclude a specific tag from the get_the_tags list
- Limit tag cloud terms by date
- URL scheme to retrieve tag archive by ID
- Post tags show outside loop?
- How to get all tags collections in woocommerce?
- In need of array of post tags
- Query all posts which do not have tags assigned to them
- Tag subscription option in wordpress. How?
- How to allow html5 tag in WordPress
- How to list custom tags too, to wp-list-table table?
- Do not change the order of the tags in the editor
- How do I style WordPress pages differently based on the tag used?
- Display posts and thumbnails with certain tags
- How can I prevent wordpress from creating tag pages?
- how can i add all my tags to tagcloud?
- Using HTML 5 Details/Summary Tag
- Blog post : Remove comma between Tag names [closed]
- Why word can’t be displayed in wordpress?
- Get all terms if product of that term contains a specific category
- How can the user place a custom text string as a placeholder for a plugin
- Show post tags on attachment page?
- How to Disable auto id attributes in Heading tag?
- What hooks are needed to bind a tag to a reusable block?
- How to echo tag description on loop-page.php using WPeC 3.8
- I want a query to list tags
- Display get_the_tag_list by order entered in the backend
- How to not display tags with less than X posts
- wordpress str_replace the content with tag
- Highlight current tag using get_tags()
- show tags on “single”-template sidebar only
- Is there any way of making post tags (or custom post type tags) pop up as suggestion as in StackExchange sites?
- How to display tags with post_content
- Echo text using is_tag
- Exclude Specific Tag On Homepage
- Change Size of P Tag on One Page Template [closed]
- How to add keyword field in custom form programmatically?
- Adding Related Articles to post
- WordPress title as keywords (tags) with excluded stop words
- Add/remove tags on frontend programmatically
- Outputting HTML elements through WP-API
- Function to echo (or display?) wordpress tags in the head section
- No line breaks in tags in tag cloud
- Custom text for certain tags
- Using has_tag() outside loop
- get_edit_tag_link does not return anything
- get an attachment’s media tags or check if it has a media tag?
- Anyway to retrieve a feed of posts that have BOTH tags?
- Top ten tags ala Delicious
- Links from the_tag not working
- Is it possible to embed a wordpress tag page on wordpress?
- List latest post for each tag with a category
- How to add product tag to order list
- How do I display all tags (linked) from all posts, inline, with a separator?
- limit number of tags shown in tag.php
- Show ‘tags’ for a post on the frontend when in a list view
- How remove tags just have one post?
- Automatically create tags and merge with categories
- Tag pages with regular editor
- How to remove base tags at the wordpress
- How to select tags in the frontend
- How are special characters encoded in tag-URL?
- How to show tags + posts for a custom taxonomy?
- Open graph ‘image’ content appears empty on debugger and filled in web source
- Is there a way to change the Tag selector from text input to checkmarks?
- Is There A Way To Add Weight Or Order To Tags?
- Mapping external data to tags via term_id
- How to take list of words and insert them as terms to become tags of a post
- Tag selection while adding new post
- Create three unique tag page templates
- Assign tags records that have a keyword
- Tags Sorted By Characters?
- How to include post count in this “get_tags” snippet
- How to retrieve the post_id of a tag page?
- How to add tags to identify custom post types in archives?
- Datetime on time tag wordpress puts it outside the tag
- See when a tag was first added
- Show all tags but exclude a certain tag
- Adding support for Post Tags to a CPT added by a plugin