{"id":173838,"date":"2024-02-19T08:00:00","date_gmt":"2024-02-19T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/test-content-generator\/"},"modified":"2025-04-07T23:06:00","modified_gmt":"2025-04-07T23:06:00","slug":"test-content-generator","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/test-content-generator\/","title":{"rendered":"Test Content Generator"},"content":{"rendered":"<p>Developing any WP plugin or theme often means needing to test it against as much of a \u201creal site\u201d as your development environment will allow, and if you\u2019re adding that test data by hand, it gets pretty tedious pretty quickly.<\/p>\n<p>This plugin will let you use either <a href=\"https:\/\/wp-cli.org\/\" rel=\"nofollow ugc\">WP-CLI<\/a> commands, or the admin page in Tools-><strong>Content Generator<\/strong> to add test users, populate the Media Library with example images, an additional test custom post type and custom taxonomies, generate as many test \u201c<em>Lorem Ipsum<\/em>\u201d posts as you want, and then add comments to those posts.<\/p>\n<p>Each of those \u201c<em>Lorem Ipsum<\/em>\u201d posts will be randomly tagged and categorised, and can also be assigned one of the test images as its Featured Image, as well as a variety of HTML content in addition to the usual paragraphs.<\/p>\n<p>This plugin is primarily for people who need to test plugins and themes on a regular basis, but it would let anyone get a feel of how their site will look when it\u2019s full of real content.<\/p>\n<h3>Workflow<\/h3>\n<p>All the parts of this plugin are optional, and each can be repeated as much as you want, depending on which parts of your site you want to test.<\/p>\n<p>However, no individual step will \u201cbackfill\u201d preceeding ones automatically, so if you have an empty site and you want (eg.) your test <em>Posts<\/em> to appear to have been written by different people, then you need to add the test <em>Users<\/em> first.<\/p>\n<p>ie.<\/p>\n<ul>\n<li>Enable <strong>Custom<\/strong> (Post Types & Categories & Tags) before adding terms from your <strong>Taxonomies<\/strong>,<\/li>\n<li>Add <strong>Users<\/strong> before downloading <strong>Images<\/strong> before generating <strong>Posts<\/strong> before adding <strong>Comments<\/strong>.<\/li>\n<\/ul>\n<h3>WP CLI Integration<\/h3>\n<p>Using the plugin defaults, you can populate a test site with just the following commands:<\/p>\n<ol>\n<li><code>wp plugin install test-content-generator --activate<\/code><br \/>\nDownload and activate the plugin.<\/li>\n<li><code>wp test users --amount=20<\/code><br \/>\nAdd 20 random Editor\/Author\/Contributor\/Subscribers users who have registered within the last 60 days.<\/li>\n<li><code>wp test taxonomies --amount=50<\/code><br \/>\nAdd 50 taxonomy terms split between Categories and Post Tags.<\/li>\n<li><code>wp test images --amount=10<\/code><br \/>\nAdd 10 images of size 800\u00d7400 uploaded by any Editor\/Author.<\/li>\n<li><code>wp test posts --amount=40<\/code><br \/>\nAdd 40 Posts written within the last 60 days by any Editor\/Author\/Contributor, with a Featured Image and both categorised and tagged.<\/li>\n<li><code>wp test comments --amount=100<\/code><br \/>\nAdd 100 comments to your Posts written within the last 60 days by any of the registered users.<\/li>\n<\/ol>\n<p>See <code>wp help test<\/code> for more details.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quickly generate a test site full of random users, posts, comments, tags and images.<\/p>\n","protected":false},"author":65,"featured_media":355938,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Test Content Generator - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Quickly generate a test site full of random users, posts, comments, tags and images."},"footnotes":""},"categories":[1],"tags":[18444,4522,44028,44029,3107],"class_list":["post-173838","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-lipsum","tag-lorem-ipsum","tag-test-content","tag-test-posts","tag-wp-cli"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/173838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=173838"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/173838\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/355938"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=173838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=173838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=173838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}