It depends on how are you importing those posts. You can use wp_insert_post() with import_id:
$postToBeInserted = array(
'post_title' => 'Your Post Title',
'post_content' => 'Your post content...',
'import_id' => 154
);
wp_insert_post($postToBeInserted);
If there is no post with the specified import_id the post will have that ID. That way you won’t have to deal with meta fields and all migrated posts will have the same ID as in the previous CMS. Although there is a drawback because it can lead to potential collisions if you continue to post new posts in the old CMS.
Related Posts:
- How to get a list of all posts and their categories?
- Get page ID of page that is set as the posts page
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Where is the old post permalink slug stored?
- Are post ID’s reliable?
- Adding additional data to WP_Post object
- get all posts ID from a category
- Passing a hardcoded page/post ID into `get_post`
- How can I safely increase the character limit for post passwords?
- Get the current post ID as a variable in Javascript
- How to Group Posts by the First Letter or Number?
- Use an attachment in multiple posts
- Restore contents of deleted user
- How are terms connected with posts in database?
- Moving WordPress to new server: no posts found
- $post->ID displays wrong ID
- At my posts archive page, outside the loop, get_the_id() returns the top most post’s ID
- Custom Taxonomies Incorrectly Counting Revisions?
- Showing random content / pictures from earlier posts in a sticky post?
- Get the post_id of a new post
- How can I display a specific user’s first published post?
- database columns: post_title vs post_name
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- Importing New Posts from Live Site into Local Dev Site
- Every possible way to get data (posts) from WordPress
- Manually removing revision post types
- Can a page_id and a post_id be same?
- How much of my site can I recover from public_html?
- Reset/Reorder posts ID in the MySQL wp_posts table
- Buddypress activity id
- Most recent post from another database
- What structure should post_content have in the database?
- Multiples Empty Posts were created and cannot delete them
- WordPress REST API not returning all posts
- How to delete all the content of a wordpress site without deleting the Post and pages?
- Post-ID in url differs from $post->ID
- Why is my Blog Page ID == First Post ID?
- Extracting post categories
- How can I get the media inside a post?
- Is it possible to change post id for an already added menu item in WordPress?
- Get ALL post ID’s export list (Only id’s. Php or sql not important )
- Search results posts_orderby and ID
- wp_posts table: safely remove unused columns to save database storage
- Remove a shortcode from all WordPress posts
- How to get a post’s content? [closed]
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- How to I retrieve the ID from the Posts page?
- Crazy Question – Updating Post ID
- Is it possible to use WP_Query to only pull posts with attachments?
- Why I can not I use the variable outside my function?
- How safe is it to delete old posts edits to save database space?
- Move posts from a non-wordpress site to wordpress
- How to Assign / Move all Deleted post to a category
- Display post number by category
- Restore woocommerce orders
- How to select particular month post from table and update the post status using MySQL?
- Accessing Post ID Within Loop
- Are post, page and category IDs unique to each other?
- linking to post outside the loop
- Update field in database for users
- Get a post’s ID
- How to get post id of last approved comment?
- Get timestamp of latest post in C#
- How to get the post id (of the parent custom custom type) in a loop inside a widget?
- Help on conditional statement to accompany wp_insert_post function please?
- Is it possible to modify posts table to only read for more recent ones?
- Pull in posts using post meta for REST API
- Menu Items disappearing/being empty on save or post edit
- My website is showing today’s date instead of published date since db migration to a new wordpress
- Get post slug and match with menu item slug to change css
- How to setup default value of post_id
- Prevent a post with a specific ID from being created
- Is update_post_meta used when save_post action hook is invoked?
- Get origin or context of a how a post got created and/or updated
- Reusing old post IDs
- Trigger on DB make problem on wordpress?
- Comments are in database, don’t show up in WordPress backend or frontend
- Is there a way to save different data when USER interacts with the same POST?
- how to fetch posts from Api in chunks or parts?
- REST API Working for GET but not for POST?
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Clean up customize_changeset in DB
- How to create REST Based JSON API(how to modify the code below)?
- How do I get a certain set of posts from the database?
- SQL trigger failes with post_content
- Only get post_id [duplicate]
- get backup file from wordpress database in x days
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- Can’t seem to replicate permalink structure for localhost development site
- When I click edit on a post, all the content disappear. Does anyone know how to fix this?
- Given two custom post types: Automatically add meta fields from one custom post type to another
- Is there a maximum amount of pages for a multi-page post?
- Custom post page has attributes of latest post [closed]
- Need All the posts with id, title and date [closed]
- Can I get custom post items in select box (dropdown)
- How to make category for word post_content
- What effect can a large wp_post table have on overall site performance?
- How can I merge a several related posts into one post?
- Restore posts, but only posts that exist in my database backup
- Server 500 error when updating post using block editor