I’m also wanting the post to be assigned the post type “Video”.
You can’t just change a post to a different Post Type. There is a difference between “Post Type” and “Post Format”.
From your examples I assume you would like to change the “Post Format”, as per the codex http://codex.wordpress.org/Function_Reference/set_post_format, you would need to paste that code in functions.php.
Then call that function in your template. eg:
<!-- Loop Start here -->
//* If post has category YouTube - set post type to video
default_post_type($post_id) {
<!-- Loop End -->
Related Posts:
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- can’t see categories in appearance-menu-categories
- Display a query with multiple post types and same relationship on a single page
- Custom post status not working
- Load custom posts with same tag as page
- Date archives for custom post type
- How can I add dropdown widget/box to admin post page?
- How to get a list of term names of the custom post type im currently on in single.php
- Custom post type loops with different page templates
- Limit Authors to their Own Posts on front-end excluding admins
- Append taxonomy terms as class names in markup?
- How do you output custom code between posts in the loop?
- Loop through posts of a custom-post-type (event) and create .ics (iCal) file?
- Output custom post shortcode. Help spot the error.
- GravityForm: Populate Dropdown with custom post type [closed]
- Return array of categories to php function for current post
- Loading all files within a directory
- Get Post Primary Category
- Weird problem happening with custom taxonmy when creating/updating posts
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- Filter categories of posts with checkboxes
- Insert HTML inside link in a walker
- What’s the difference between same wp functions get_posts(); functions in different form?
- Get posts from a custom post type by child categories of a parent category
- Show category ID on custom post type
- How to customize a permalink (URL) structure?
- Get parent categories of custom post type
- Can I list a custom post type within another custom post type in the admin area?
- Make a custom_post translatable
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Different Category system needed for the Custom Post Type
- Redirect to another page using contact form 7? [closed]
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- Category.php template for custom posts
- categories should be available across all custom post types
- PHP question: how to combine syntax?
- Loop increase number
- custom post for slider
- WP_Query Custom Post Type if Category ID Equals
- Navigate posts with different post type that are in the same categories
- Showing custom post type categories in the menu
- How to use a variable as a function name?
- Assigning a category to a custom post type in WordPress
- How exclude or skip post type with get_next_post_link
- Create short URL with auto 301 redirect
- Removing full title and breadcrumb header container for a specific post type
- Is it possible to use array_walk() to append terms to an array of posts?
- Show current user posts in custom post type query
- Custom Ratings for Theme, Proper way to Refactor Code and Clean up Template File
- post_content is stripping HTML when adding a new post? [closed]
- Using Wp_Query, Json to add Highcharts series data
- Template code to split a post and print a custom field?
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Let users upload image(s) to the post from front end
- Foreach loop returning more than one item when querying taxonomy
- Function to erase every post from a taxonomy
- Menu’s breaking, now showing all page links on site
- Post type Echo code is repeating on homepage
- Show the categories the current post has
- redirect after submiting post for review
- How to divide Subcategories into pages of parent category wordpress
- Custom front-end form for adding post – Category problem
- set object terms after some some time of published post – functions.php
- php dynamic content inside shortcode
- update custom taxonomy custom fields
- Title and URL Error in Breadcrumb Navigation for Custom Post Types
- Check that a slug is present in the get_terms request
- Pagination not working in custom post type. Help
- How to add specific terms in a custom post type?
- Assigning categories to custom post types via a front-end form; only works for native post type
- Limit custom post type to the authors only on front-end!
- In the php, how can I have a category of a custom post type display?
- Create posts inside CPT post
- Persist meta box choices throughout all posts of same post type
- ACF field check value of field on all other articles
- Get meta values from parent post and save in child post
- Change Search display for Custom Post Type
- Custom Post By Category
- Stored meta from attachment, video length?
- Duplicate posts in my custom loop
- How to sort custom post’s category by id from the theme’s function.php?
- Getting a 404 on single custom post type page when using rewrite on a custom taxonomy
- How To Display Category list from Portfolio post type plugin?
- Featured image in custom post is being disabled
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Function not pulling image or text from custom post type
- How to call Shortcode categories for custom post types?
- Stop header code from showing in category page?
- Custom Loop for custom post type. Compare by meta_value?
- Code in custom widget queries all posts, when it should only query the current post
- Add HTML before a specific div?
- How to string lines from the_content() hook in WordPress?
- Comments are not working on Custom Post Type
- Add Category names to post lists of custom post type
- How to I add count of custom posts listed in a post as a prefix to its title
- how to display custom taxonomies in front page
- add_rewrite_rule not working with custom post type
- How do loop categories post from according in WordPress? is it impossible to solve this problem?
- How to get the proper category in permalink with custom post type assigned to multiple categories
- Is it possible to go to the next post in the same category?