Title: Duplicate post by SQL query
Last modified: November 13, 2022

---

# Duplicate post by SQL query

 *  Resolved [digitalforge](https://wordpress.org/support/users/digitalforge/)
 * (@digitalforge)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/duplicate-post-by-sql-query/)
 * Hey guys,
 * I have to import over 100k pages. I wrote a SQL query that basically just duplicates
   the wp_posts and wp_post_meta entry for one specific **post**.
 * This works, the page is visible and so on, but it almost looks like it has no
   styling and -or something is wrong with elementor.
 * Does anyone know if I am missing tables or something?
 * I cannot use any existing plugins for this as they all charge money for something
   that I will only use once, besides that I would like to learn it myself 😉
 * Hope someone can help me out.
 * So in total what I did was:
 * 1. Duplicate 1 row from wp_posts with new title, content and a unique id
    2. 
   Duplicate 16 rows from wp_post_meta with the post_id pointing to the correct 
   id
 * This shows the page both in the backend and on the website (as a visitor) but
   the styling seems to be missing.
 * Hope someone can explain to me how to duplicate a specific post by using SQL 
   queries.
 * **What I copied from wp_post_meta**
 *     ```
       _edit_lock
       _wp_page_template
       _edit_last
       _elementor_edit_mode
       _elementor_template_type
       _elementor_version
       _elementor_data
       _happyaddons_elements_cache
       _elementor_page_assets
       _pingme
       _encloseme
       _elementor_css
       ```
   
    -  This topic was modified 3 years, 6 months ago by [digitalforge](https://wordpress.org/support/users/digitalforge/).
      Reason: added additional info

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [digitalforge](https://wordpress.org/support/users/digitalforge/)
 * (@digitalforge)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/duplicate-post-by-sql-query/#post-16199235)
 * No one knows? not even the creators of the amazing Elementor plugin?
 *  [Elementor Team](https://wordpress.org/support/users/ozyeger/)
 * (@ozyeger)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/duplicate-post-by-sql-query/#post-16203060)
 * Hi,
 * Is there any specific reason to not use a default WP Import Export? It should
   work as expected since you are working only with pages.
 *  Thread Starter [digitalforge](https://wordpress.org/support/users/digitalforge/)
 * (@digitalforge)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/duplicate-post-by-sql-query/#post-16203168)
 * [@ozyeger](https://wordpress.org/support/users/ozyeger/) thank you for your reply
   🙂
 * The reason I want to use SQL query to make the duplicates is because I have to
   change the “textual content” for each and I don’t want to manually do over 100k
   pages which would take literally months to do.
 * If I can do it by SQL query it would take me less then 3 minutes in total, that’s
   the whole reason I would like to use SQL queries 😉
 * So basically the pages are 100% identical to one another. The only difference
   is the text in one specific text block and that’s it basically.
 * P.S. it is not a page but a **post** which I want to duplicate.
 * Best regards
    -  This reply was modified 3 years, 6 months ago by [digitalforge](https://wordpress.org/support/users/digitalforge/).
 *  [Elementor Team](https://wordpress.org/support/users/ozyeger/)
 * (@ozyeger)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/duplicate-post-by-sql-query/#post-16209046)
 * Hi,
 * I am sorry, It’s related to WordPress, you may start a Github thread.
 *  Thread Starter [digitalforge](https://wordpress.org/support/users/digitalforge/)
 * (@digitalforge)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/duplicate-post-by-sql-query/#post-16209300)
 * No it is not related to WordPress. It is YOU’RE plugin that makes the tables 
   that need to be copied and my question is quite simple. What tables and rows 
   would I need to copy to make (the Elementor part) work when duplicating a post.
 * I already asked on the WordPress forums and they send me to the Elementor plugin
   forum because they don’t know and the plugin is made by your team/ company 😉
 *  [Elementor Team](https://wordpress.org/support/users/ozyeger/)
 * (@ozyeger)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/duplicate-post-by-sql-query/#post-16218457)
 * Hi,
 * Please open the thread on GitHub, so developers can help you. It is Custom Code/
   WP related as the DB structure is part of the WP not only Elementor.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Duplicate post by SQL query’ is closed to new replies.

 * ![](https://ps.w.org/elementor/assets/icon-256x256.gif?rev=3444228)
 * [Elementor Website Builder - more than just a page builder](https://wordpress.org/plugins/elementor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/elementor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/elementor/)
 * [Active Topics](https://wordpress.org/support/plugin/elementor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/elementor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/elementor/reviews/)

## Tags

 * [duplicate](https://wordpress.org/support/topic-tag/duplicate/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * 6 replies
 * 2 participants
 * Last reply from: [Elementor Team](https://wordpress.org/support/users/ozyeger/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/duplicate-post-by-sql-query/#post-16218457)
 * Status: resolved