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?
- Can posts have parents?
- How to use “Add link” pop up for a WordPress widget
- Where is the old post permalink slug stored?
- Separate Database Tables For Different Post Types
- Are post ID’s reliable?
- Adding additional data to WP_Post object
- Get current post id in functions.php
- 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
- Is post ID number always incremental n+
- How to Group Posts by the First Letter or Number?
- Use an attachment in multiple posts
- The loop starting at a certain ID
- linking to post outside the loop
- Update field in database for users
- Widget to show posts in the sidebar basing on its IDs
- Import custom database into wp and keep the post id
- Get a post’s ID
- Making posts permalinks consistent numbers
- why the posts queried from sql is more than those showed on the page?
- How to get post id of last approved comment?
- Moved to a new server, backup was a day old and missing 3 posts, anyway to recover them from old host?
- 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?
- Is there a function to get post info for any publish_status by post ID?
- Your ideas on my though “delete or move all of the posts in a specific category when 3 days are passed”
- How Can I Always Display A Particular Post First Using WP_Query?
- Help on conditional statement to accompany wp_insert_post function please?
- How can I globally italicize list of texts in the UI database or Posts? [closed]
- 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
- WordPress Post ids big increment
- How to setup default value of post_id
- exclude particular category in api
- Prevent a post with a specific ID from being created
- Is update_post_meta used when save_post action hook is invoked?
- Reuse old post ID for new post after deleting post
- Bulk find & replace on WordPress posts/pages (minus image paths)
- Get origin or context of a how a post got created and/or updated
- Get post attachment with post id
- 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?
- How can I stop ‘in use’ message from intermittently blocking my wp_posts table?
- REST API Working for GET but not for POST?
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- how i show manual data in a post
- Clean up customize_changeset in DB
- How can i take all ids from untrash_post action?
- How do I apply a wordpress function to something with no ID inside an archive page?
- 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?
- Maximum number of posts per page before affecting performance?
- SQL trigger failes with post_content
- Get from the dashboard the ID of the current post being edited
- Problem with wp_insert_post()
- Only get post_id [duplicate]
- get backup file from wordpress database in x days
- Is it possible to have dynamic post id # in add_menu_page()?
- Expired Post with More Recent Time Stamp?
- Converting Posts to Pages
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- How to change the publishing date of each posts?
- Can’t seem to replicate permalink structure for localhost development site
- Extra field in wp_post instead of postmeta
- Voting System, database connections?
- When I click edit on a post, all the content disappear. Does anyone know how to fix this?
- Using Post ID and Page ID in same function
- Given two custom post types: Automatically add meta fields from one custom post type to another
- unused post IDs
- Load posts from external source if not found in database
- 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 is $post->ID
- What effect can a large wp_post table have on overall site performance?
- View post with specific category id and name which I selected in the backend (drop-down option)
- How can I merge a several related posts into one post?
- Restore posts, but only posts that exist in my database backup
- How to get post ID after removing that post?
- Change permalinks in posts via SQL
- Is it safe to totally unregister the default “post” Post Type
- Server 500 error when updating post using block editor
- ‘403 Forbidden’ when publishing a post containing different blocks
- How to manually delete post from database without causing conflicts?
- Why does ‘get_the_ID’ work outside of the loop?
- WordPress Rest API Post request from AMP
- Can’t save/get Patterns’ `post_content` attribute