{"id":50239,"date":"2019-11-21T11:55:00","date_gmt":"2019-11-21T16:55:00","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=50239"},"modified":"2021-08-16T15:51:00","modified_gmt":"2021-08-16T19:51:00","slug":"how-to-copy-post-content-html-from-wordpress-with-wp-cli","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/","title":{"rendered":"How to Copy Post Content HTML from WordPress with WP-CLI"},"content":{"rendered":"\n<p>Date: 11\/8\/19&nbsp;&nbsp;2 Minutes To Read<\/p>\n\n<p>\n<a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/wp-cli-search-replace-command\/\">WP-CLI<\/a> is a command line tool that comes with your <a href=\"https:\/\/www.inmotionhosting.com\/wordpress-hosting\">WordPress Hosting<\/a> package. You can use it to manage your WordPress site with quick and intuitive command line instructions. Utilized properly, WP-CLI can drastically speed up your workflow and replace tedious dashboard operations with efficient scripts you can repeat and automate.\n<\/p>\n\n<div id=\"text-table-of-contents\">\n<ul>\n<li><a href=\"#code\">Copy post content code snippet<\/a><\/li>\n<li><a href=\"#copy-content\">How to copy post content with WP-CLI<\/a><\/li>\n<\/ul>\n<\/div>\n\n<p>\nUsing the new Gutenberg editor lets you place content into convenient blocks. But what happens if you need to copy the content of a long int HTML? You would need to preview each Gutenberg block separately as HTML, copy, and paste it into a local HTML file. For a long post, this is incredibly time-consuming and will introduce multiple opportunities for error. Using WP-CLI can ensure you copy the HTML content perfectly and preserve it in an HTML file.\n<\/p>\n\n<div id=\"outline-container-org5fa2ec0\" class=\"outline-2\">\n<h2 id=\"code\"><a id=\"org5fa2ec0\"><\/a>Copy Post Content from WordPress With WP-CLI One-liner<\/h2>\n<div class=\"outline-text-2\" id=\"text-code\">\n<p>\nWP-CLI provides an easy shortcut for accessing specific database tables where your content. Using the command below you can have WP-CLI go into the database, get post content, and output that content to a file:\n<\/p>\n\n<p>\nSend content to a file in the same directory:\n<\/p>\n\n<p>\n<code>$ wp post get 123 --field=content &gt; file.html<\/code>\n<\/p>\n\n<p>\nSecond content to a file in your home directory by adding a tilde <code>~<\/code>:\n<\/p>\n\n<p>\n<code>$ wp post get 123 --field=content &gt; ~\/file.html<\/code>\n<\/p>\n<\/div>\n<\/div>\n\n<div id=\"outline-container-orge8d3860\" class=\"outline-2\">\n<h2 id=\"copy-content\"><a id=\"orge8d3860\"><\/a>How to Copy Post Content to a File with WP-CLI<\/h2>\n<div class=\"outline-text-2\" id=\"text-copy-content\">\n<p>\nHere are the steps on how to use the above commands and where they need to go:\n<\/p>\n\n<ol class=\"article_list\">\n<li>Log into your terminal<\/li>\n<li>Navigate to the WordPress site directory (where the core files reside)<\/li>\n<li>Get your post ID <a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-find-post-details-using-wp-cli\/\">using WP-CLI<\/a> or previewing a URL from the post list in the dashboard (URL will contain <code>?post=###<\/code>)<\/li>\n<li>Use one of the above code snippets with the post ID number<\/li>\n<\/ol>\n\n<p>\nWhen you visit your file, you will notice that it is filled with HTML content you can save or paste into WordPress as needed.\n<\/p>\n<\/div>\n<\/div>\n\n\n<p>Learn more about <a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/\">WP-CLI<\/a>, the command-line interface for WordPress, and how to streamline your WordPress maintenance workflows!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Date: 11\/8\/19&nbsp;&nbsp;2 Minutes To Read WP-CLI is a command line tool that comes with your WordPress Hosting package. You can use it to manage your WordPress site with quick and intuitive command line instructions. Utilized properly, WP-CLI can drastically speed up your workflow and replace tedious dashboard operations with efficient scripts you can repeat and<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/\"> Read More ><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4374],"tags":[],"class_list":["post-50239","post","type-post","status-publish","format-standard","hentry","category-wp-cli"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Copy Post Content HTML from WordPress with WP-CLI<\/title>\n<meta name=\"description\" content=\"While the new Gutenberg editor is helpful, sometimes you just need to copy a large amount of HTML code from your WordPress site. This guide will show you how.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Copy Post Content HTML from WordPress with WP-CLI\" \/>\n<meta property=\"og:description\" content=\"While the new Gutenberg editor is helpful, sometimes you just need to copy a large amount of HTML code from your WordPress site. This guide will show you how.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-21T16:55:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-16T19:51:00+00:00\" \/>\n<meta name=\"author\" content=\"Christopher Maiorana\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Maiorana\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/\"},\"author\":{\"name\":\"Christopher Maiorana\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\"},\"headline\":\"How to Copy Post Content HTML from WordPress with WP-CLI\",\"datePublished\":\"2019-11-21T16:55:00+00:00\",\"dateModified\":\"2021-08-16T19:51:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/\"},\"wordCount\":324,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"WP-CLI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/\",\"name\":\"How to Copy Post Content HTML from WordPress with WP-CLI\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2019-11-21T16:55:00+00:00\",\"dateModified\":\"2021-08-16T19:51:00+00:00\",\"description\":\"While the new Gutenberg editor is helpful, sometimes you just need to copy a large amount of HTML code from your WordPress site. This guide will show you how.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Copy Post Content HTML from WordPress with WP-CLI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\",\"name\":\"Christopher Maiorana\",\"description\":\"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Copy Post Content HTML from WordPress with WP-CLI","description":"While the new Gutenberg editor is helpful, sometimes you just need to copy a large amount of HTML code from your WordPress site. This guide will show you how.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/","og_locale":"en_US","og_type":"article","og_title":"How to Copy Post Content HTML from WordPress with WP-CLI","og_description":"While the new Gutenberg editor is helpful, sometimes you just need to copy a large amount of HTML code from your WordPress site. This guide will show you how.","og_url":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2019-11-21T16:55:00+00:00","article_modified_time":"2021-08-16T19:51:00+00:00","author":"Christopher Maiorana","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Christopher Maiorana","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/"},"author":{"name":"Christopher Maiorana","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f"},"headline":"How to Copy Post Content HTML from WordPress with WP-CLI","datePublished":"2019-11-21T16:55:00+00:00","dateModified":"2021-08-16T19:51:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/"},"wordCount":324,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["WP-CLI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/","url":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/","name":"How to Copy Post Content HTML from WordPress with WP-CLI","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2019-11-21T16:55:00+00:00","dateModified":"2021-08-16T19:51:00+00:00","description":"While the new Gutenberg editor is helpful, sometimes you just need to copy a large amount of HTML code from your WordPress site. This guide will show you how.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/wp-cli\/how-to-copy-post-content-html-from-wordpress-with-wp-cli\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Copy Post Content HTML from WordPress with WP-CLI"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f","name":"Christopher Maiorana","description":"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.","sameAs":["https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/50239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=50239"}],"version-history":[{"count":4,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/50239\/revisions"}],"predecessor-version":[{"id":106509,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/50239\/revisions\/106509"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=50239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=50239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=50239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}