You can use Function Reference/set post type
<?php
$post_id = 15;
if ( set_post_type( $post_id, 'page' ) ) {
echo "Post #$post_id is now a Page";
} else {
echo "Impossible to transform this post into a page";
}
?>
Related Posts:
- WP cron: when to schedule a 1-time event
- Set post to draft after set period based on post_modified date
- Running a function on post content and CPT meta
- Auto Draft Specific Categories Posts after a certain number of Days
- Loading custom content type from ajax results?
- Trash / Draft a WordPress custom post after custom date field expires
- I’d like to cycle through existing posts in a post type, showing one per day ordered by title, and starting over when the last is reached
- How do you make a custom post type items automatically delete items 3 months after publication?
- Auto Expire/Delete Custom Post Type Posts after specified time
- What is the most efficient way to execute recursive complex queries?
- Set up a WP Cron scheduled event to update calculated ACF field
- Update post status from “publish” to “trash” prior to year 2018
- Trigger WP CRON from a date in a Custom Field?
- wp_set_post_terms not updating with WP Cron Event
- Reading csv from specific directory and insert it to custom post type (cron job)
- Can multiple custom post types share a custom taxonomy?
- How to Add Custom Fields to a Custom Post Type?
- limit selection of custom taxonomies to one?
- Importing old blog with regular posts into new custom post types
- $wp_query->queried_object->ID throws warning: Undefined property
- Load custom posts with same tag as page
- Meta Query “IN” doesn’t work with ACF checkbox filter
- How do you modify the ‘post_parent’ of a custom post type?
- How to show related posts by category or custom post type?
- Archive or taxonomy pages not working for custom post type
- Custom Taxonomy returns no posts
- Custom template for post type not working
- Frontend posting – everything saves other than checkboxes?
- Update content of multiple pages/posts at once?
- Page as a child of a Custom Post Type
- Custom post types and permalinks
- Fetch taxonomies by custom post type id array
- Normal pages as children of my Custom Post Type
- post_type_link not working in gutenberg
- Cannot save Checkbox meta box value from a Custom Post Type
- Sorting custom post type columns with external data and without meta values
- Custom post ui plugin & WP_Query – Polylang
- How to add a post slug to a url?
- Change CPT archive title
- The loop seems stuck to a single (now deleted) post
- Custom post type archive page for multiple post types
- Invalid argument supplied in register_taxonomy $args->taxonomies
- Targeting custom post type
- Add the post type to the title of the page
- category page for custom post type
- WP_query – Filter by tax_query and meta_query using multiple select
- Hide meta box for everything BUT a certain custom post type
- Create a list of recent Custom Post Types posts
- Empty search input does not return all posts
- Display custom tags for custom post listing page
- Update all published posts at once
- How to convert custom fields to content
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Custom post type not pulling CSS
- Hide the update button from edit view in wordpress custom post type
- Add link for CPT to another CPT on submit button
- How to stop post status from reverting to Published?
- How to make id user can be view content
- Redirect users in first login to a dynamic link
- Custom permalink rewrite rules – how do I fix this?
- Custom Pagination based on Custom Post Type
- Link Custom Post Type Sidebar to Page/Posts
- WordPress custom post type
- Show Custom Post Type taxonomy term that matches custom field
- Redirect preview single post link to a page
- paging is not working properly on news archives page [duplicate]
- Yearly Archive from a custom date metabox (Event Start Date)
- Custom Post Query Combined with Conditional Tags
- How to Display Custom Taxonomies in an Un-ordered HTML List
- 404 with Custom Post Type
- Custom post type permalink structure
- How do I use CPT and permalinks with a mobile theme?
- Knowledgebase / Docs: Custom Post Type, Pages or as a Post Category?
- Add top-level menu pointing to a different custom post type?
- custom post type not getting archived?
- Archive page for Custom Post Type taxonomy?
- How can I show second most recent post in sidebar, if most recent post is open in the browser?
- how to display custom taxonomies in front page
- Elementor Custom Query to get Posts by ACF (Post Object Field
- How to separate posts by categories?
- How to add a regular page under a custom post type?
- menu item to point to custom posts list
- Internal Server Error when echoing an OBJECT from wp ajax action function in functions.php to JS file
- Create WP multisites as a custom post type
- WordPress WP_Query Sort by 2 dates – custom fields
- Post content in bootstrap modal
- Get term link of shared taxonomy between multiple post types
- Custom post type with custom taxonomies structure url not working archive of CPT
- Make term slugs of custom taxonomy available in WP REST API for custom post type?
- How to display *block number* instead *date value* on WordPress posts?
- An script/Plugin for automatic page creation per term
- How do I display custom post type data in Team Table?
- Dynamic WordPress rewrite rules for multiple custom post types
- Mixing custom post types and standard post types is distorting page layout
- WordPress Multisite Network Shared Custom Post from Main Site using single-CPT.php
- Cannot attach custom taxonomy term to a custom post type. Post taxonomy terms are not saving
- WordPress CPT archive page display sticky post first and then display the rest of the posts in same Query
- coloring row’s background based on custom field value
- How to exclude html tags and class on search
- How to Create Grey Background for Product Images on Website Display but Retain White Background on Downloaded JPGs?