Yes, use the “import_id” field in the post, when calling wp_insert_post.
This is treated as a “suggested” ID for the post that will be used if no post with that ID already exists.
$post = array(
'post_title'=>'whatever',
'post_content'=>'whatever',
'import_id'=>123
);
wp_insert_post($post);
Related Posts:
- Moved WordPress to New Server, Now Tries to Download a File
- Do you have any effective strategies for launching a v2 of a WP site?
- Change site url when moving site to another url?
- Migration issue – blog home page is blank
- Recover WordPress blog from an inactive domain name
- How to transfer changes from test environment to live site?
- References to other site everywhere in WordPress site
- Plugins to clone wordpress site and move to another url
- 500 Internal Server Error after attempting to switch from subdirectory to addon domain
- Export and overwrite pages on import?
- How to upload local changes to a live server without overriding new posts/pages?
- Does WordPress Import/Export tool actually exports media (images) as well?
- Migrating my existing WP site to localhost
- Will post id change when migrating to new site?
- Setting up WordPress playground and deploying to production server?
- Critical Site Health Issue after WordPress Migration
- Error migrating from live website to localhost
- Why isn’t my imported database showing up? install.php pops up and adds new tables to the database
- Can I setup WordPress in a subdirectory and then point my URL to the subdirectory when I’m ready to go live?
- call_user_func_array() errors after migrating site with InstantWP
- We have a static Hugo website and we want to migrate it to WordPress
- How do I force password reset even with wrong password entered?
- How can I migrate (export and import) wordpress users without loosing their password?
- Tags not importing when using WordPress import system
- Move from Subdomain to Root
- migrating local dev site to live site with no downtime
- preventing the duplicate wp_insert_post
- Is there a way to migrate via wordpress dashboard?
- Trying to move an Expression Engine site to WordPress, but not having luck with content
- Migrate ProcessWire to WordPress
- Cannot complete migration on LAMP
- Nginx mamp pro5 migration home page works all other do not
- migrating my wordpress site
- Is it possible to transfer my local installation entirely to the server?
- Why WordPress isn’t and/or can’t be domain agnostic
- migrated wordpress site not running properly, on Ubuntu localhost?
- The easiest way to migrate a wordpress website across servers
- Moving my newly made site from subdirectory
- Clean private data (passwords, ftp, database) before zipping my site and SQL and give it to other person
- how to update link on live site from test site
- Migrating to local server
- wordpress changing host breaks image links
- Tried to move blogs to a new server – “white screen of death”
- Images in the post still pointing to older domain after domain change
- Blank screen after moving WordPress to new server with same domain name
- I changed my domain name and REST API stopped working
- Getting HTTP error 500 after migrating a website
- migration wordpress to local machine does not work with all broken URLs except frontpage
- Uncaught Error: Class ‘Redis’ errors on a site I’ve transfered to new hosting
- WordPress migration to new domain and environment with only zip file
- Server Migration Issues
- Migrating WP website from local host
- After migration the website is really slow
- Migrate posts and photos from a blog to another
- Migrating stats from WordPress.com blog to self-hosted WordPress.org blog
- Transfer WordPress
- Server ip to Domain
- Migrating from foo.com/wordpress/ to foo.com/ — how can I do it?
- Deploying from local to dev: pages do not work
- Migrate VB.net website to wordpress website
- How do you do your big exports / imports?
- Import from Windows to Linux
- Wrong URL to CSS and JS after change domain
- Migrate site from local to local via a backup
- Migration from environment to master WordPress
- How to recover wordpress website moved from a PC to another
- Making a development site live, on Amazon EC2
- What happens if I replace the files of a WordPress site with another WordPress site?
- How I shift me website from WordPress managed to linux hosting?
- Update around 200,000 posts
- Move wordpress files from one pc to another pc contents showing error
- Migrating a whole website to WordPress
- Migration from XAMPP in windows to MAMP in Mac
- Internal server error
- Redirects and Subdirectory migration to Root Directory
- Moving WordPress site from local PC to local Mac
- How to transfer /wordpress folder from one Mac to another
- How to move a locally built wordpress website to live server using wordpress importer
- Copy template with plugins to another hosting provider
- WordPress giving gibberish and wp-admin gives HTTP 500 error
- Moved wordpress dashboard still pointing to testing server
- WordPress migration ended with 500 Error page on pages excluding homepage
- Authorization link broken when migrating from Blogger to WordPress
- Migrating a WordPress site has broken UTF8 encoding
- Migration to staging server, pages from other site loading in
- Error after moving wordpress blog
- Fast way to copy a Blog x to another domain/server without deleting it
- how to move a wordpress blog to my static site
- How to migrate, does WordPress hardcode or shortcode image URLs?
- Migrating domain name from old WP host to new (which uses vhosts)
- Can’t restore my wordpress site from zip back up file
- ColdFusion site to WordPress?
- How do I set up a test environment in a sub-folder?
- Change a web programmed in ASP.net to WordPress from scratch in the same Hosting
- How to migrate a local WP installation onto Digital Ocean
- Moving wordpress to root folder = internal server error
- Pages do not load after migration to new server
- wp-admin keeps forwarding me to an old url
- How to migrate new web design to an existing website?
- How to add Featured Image on WXR from External Conversion