Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

How to move a post to different post type with all meta data?

As has been mentioned in the comments – changing the post type of a post only changes its ‘post type’ column. All post metadata is associated with the post ID and this never changes.

However, you may not see this information: if the old post type had a metabox or taxonomy associated with that, that the new post type doesn’t – then while the relationship of the converted post with its metadata / taxonomies still exists in the database, it won’t appear in the admin screen.

If you have any metaboxes or taxonomies for your ‘new cars’ post type, you’ll want to register them with your ‘sold cars’ too. For taxonomies this is done by specifying the post types when registering:

register_taxonomy('my-taxonomy',array('new_cars','sold_cars', $args);

Or when registering a custom post_type (see register_post_type()), or by using register_taxonomy_for_object_type().

Similarly you’ll want to add your metaboxes to both post types:

add_meta_box( $id, $title, $callback, 'new_cars', $context, $priority, $callback_args )
add_meta_box( $id, $title, $callback, 'sold_cars', $context, $priority, $callback_args )

and ensure that the associated processing runs for both post types.


However – from what it seems you’re after, you should be using a post type ‘cars’ and register a taxonomy (say ‘car_status’), as well as you’re existing ‘make’ taxonomy.

Then a car can be associated to a car status term (say ‘new’ or ‘sold’).

To get all new cars of make xyz you can use the tax_query argument of get_posts or WP_Query

$args = array(
    'tax_query' => array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'car_status',
            'field' => 'slug',
            'terms' => array( 'new')
        ),
        array(
            'taxonomy' => 'make',
            'field' => 'slug',
            'terms' => array( 'xyz')
        )
    )
);
$query = new WP_Query( $args )

Related Posts:

  1. Changing to different post type maintains the redirection?
  2. Can the Next/Prev Post links be ordered by menu order or by a meta key?
  3. Meta query with boolean true/false value
  4. Custom field values deleted when trashing custom post type
  5. Custom Post type – how to get checkbox to update meta field to null
  6. How do I Paginate Search Results for Custom Post Types?
  7. Ordering posts having multiple post-meta date fields
  8. How do I remove all the metaboxes for a custom post type?
  9. Custom Queries: Joining On Meta Values From Two Custom Post Types
  10. How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
  11. Grossly inefficient wordpress loops!
  12. How Do I Use WP_Query to Run This Database Query as Search Result?
  13. WordPress Admin Panel search posts with custom post meta values along with title
  14. Rest Api v2 orderby meta_key in custom post type
  15. Custom post type category not displaying in custom post type
  16. How to make custom post meta wp_editor translatable?
  17. How to add multiple featured image in meta box in post editor?
  18. update_post_meta() whenever custom post type is updated
  19. Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
  20. How to best delete orphan wp_postmeta
  21. Count posts with specific term_meta
  22. Custom search for custom post meta with pre_get_posts interferes with WP search
  23. WordPress Orderby Numeric Value Not Working
  24. Replace title column in post list with post meta value
  25. My theme saves their custom post type’s metadata as a serialized array, how to access the keys?
  26. Does WordPress limit the length of slug names for Post Meta or Terms?
  27. Insert Multiple Post with Same Publish Button
  28. Undefined Variable – Custom Post Type Meta
  29. Ordering posts in Search & taxonomy by post_meta
  30. Post image in WordPress not appearing on home page
  31. changing meta value and meta key of price field
  32. Posting to a Custom Post Type from front end – user generated content
  33. Update Post Meta for a logged in user
  34. Getting meta in editor plugin, and event triggering issue
  35. Restrict Access to Posts based on Custom User and Post Meta Data
  36. Metabox not show in categories custom post type cmb2
  37. Importing Data from a Non-WordPress database, into WP
  38. List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
  39. Can’t publish custom post type – “You are not allowed to edit this post.”
  40. Filter date from post meta when date is in string format
  41. Get only used meta_values
  42. Submitting Custom Post Types with custom fields from Front-end form
  43. Get $post->ID from a URL
  44. Displaying a div from an assigned meta_value when on a page
  45. Setting Post Title via Meta Data returns Auto-draft
  46. Filter posts by tax (dropdown) and meta value
  47. Publish and save specific postmeta to a filtered post_type
  48. Custom post type suddenly stoped working after WordPress 5 update
  49. Batch Extract Date from post title and put into ACF custom field
  50. How to show custom field on specific custom post type posts only when filled
  51. How to handle this specific case of custom post type?
  52. Save CTP post meta different values each day without overwriting previous values
  53. get_post_meta returns NULL in front-end, but correct result in back-end
  54. is_main_query() never called on WP 4.4
  55. Meta box data is saved but NOT displayed in the meta box text field. Why?
  56. Related posts meta_query CPT
  57. Meta box with front-end styling
  58. Sanitaizing Select Optin For Custom Post Type Metabox in WP
  59. Cannot Save MetaBox Data in Custom Post Type
  60. Getting WordPress to store 0 values for custom post type meta
  61. Say I have a tech blog, how best would I store technical specs for a phone, if i use custom post types
  62. Problem Saving Custom Post Type Meta Values
  63. Hide title field of selected post-types on edit pages
  64. Get_post_custom not fetching value from array wordpress
  65. Save data is post using php front end
  66. How to keep custom post type related information
  67. Can’t save meta box data in WordPress using custom post types
  68. Creating a custom post type upon registration for a specific user role
  69. How to sort by multiple values in a nested WP_Query
  70. Where is get_post_meta value located?
  71. How can I use a custom template to load custom post type posts based on a post_meta value
  72. How do I create a customised table list of a custom post type (in the admin area)?
  73. How to properly get the wp_postmeta.meta_value of a custom post type in specifics?
  74. get_post_meta not working with variable as a post_id for dynamically get the postid
  75. How to save post_status using action save_post?
  76. Custom post meta box as a sub form
  77. Metaboxes in Loop
  78. Add more custom fields when creating a new custom post type
  79. Custom meta box data not saving
  80. Collect custom post in a calendar
  81. Storing data in a multidimensional array from dynamically generated foreach loop
  82. How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?
  83. meta query always fails even if data is correct
  84. Problem with ‘save_post’ hook not running
  85. Values inside a custom field to determine which category posts to display
  86. Display a post count from a custom metabox selection
  87. How to rewrite CPT-Permalinks the correct way (incorporating meta-box-data)?
  88. Custom post type submenu sorted by specific meta_key & meta_value
  89. Advanced search form with filters for custom taxonomies and custom fields
  90. Top 30 Songs using Custom Post Type
  91. Querying meta values within an array
  92. Post AND page parameter for WP function
  93. why get_post_meta is returning 0?
  94. Save post_parent in a custom post type
  95. How to display Author Profile based on Custom field value
  96. Automatically add custom taxonomy when meta value gets to a set number or beyond
  97. Display a list of posts whose meta field values are equal to the ID of the post being viewed?
  98. Update an existing post in a custom post type
  99. Check for custom field value in different post type than current one and do something
  100. I am having a problem with fetching product data in the Gutenberg block editor
Categories custom-post-types Tags custom-post-types, post-meta, switch
Show Excerpts In Twenty Eleven Theme
Upgrade to 3.3.2 return a blank admin page

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress