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:
- Get page ID of page that is set as the posts page
- 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`
- Get the current post ID as a variable in Javascript
- Is post ID number always incremental n+
- 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
- Showing random content / pictures from earlier posts in a sticky post?
- Get the post_id of a new post
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- Insert posts in two tables
- Instead of submiting an entire post, is there any way to submit a lite-post or a simple message?
- Every possible way to get data (posts) from WordPress
- Reset/Reorder posts ID in the MySQL wp_posts table
- Getting current post ID in functions.php
- Most recent post from another database
- What structure should post_content have in the database?
- 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?
- Is it possible to change post id for an already added menu item in WordPress?
- Search results posts_orderby and ID
- Copy post to separate database with “add_action(….)”
- Retrieve post ID from “querying” URL
- When open add new post or page WordPress add post with ID=0 continuously [closed]
- wp_posts table: safely remove unused columns to save database storage
- Anyone know why wordpress converts some html entities to their numeric equivalents?
- Remove a shortcode from all WordPress posts
- What do these phpMyAdmin errors mean on my WordPress databaes?
- 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?
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- Is it possible to use WP_Query to only pull posts with attachments?
- Get posts and include taxonomy term
- Why I can not I use the variable outside my function?
- Change post-slug using wordpress API? Change permalink of a post using php / jquery?
- Add field to user meta table in database when link is clicked
- How safe is it to delete old posts edits to save database space?
- Delete post revisions only for a single post
- wp_posts table extremely large
- How to Assign / Move all Deleted post to a category
- Display post number by category
- Saving Post Data in Another Database
- Restore woocommerce orders
- WP_Query custom field pass the post id
- Accessing Post ID Within Loop
- How do post IDs work in WordPress?
- Are post, page and category IDs unique to each other?
- 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
- Making posts permalinks consistent numbers
- 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?
- 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
- How to setup default value of post_id
- exclude particular category in api
- Prevent a post with a specific ID from being created
- Reuse old post ID for new post after deleting post
- Get post attachment with post id
- Reusing old post IDs
- Trigger on DB make problem on wordpress?
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- how i show manual data in a post
- How can i take all ids from untrash_post action?
- How to create REST Based JSON API(how to modify the code below)?
- 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
- 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
- How to change the publishing date of each posts?
- Extra field in wp_post instead of postmeta
- Voting System, database connections?
- 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
- Custom post page has attributes of latest post [closed]
- Can I get custom post items in select box (dropdown)
- What is $post->ID
- View post with specific category id and name which I selected in the backend (drop-down option)
- 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