- Contributors: me (Benoît Hubert)
- Site URL: https://developpeur-web-toulouse.fr/
This plugin generates content (posts, comments, categories, tags) in order to populate a WordPress site. It generates "real" text, not lorem ipsum.
The motivation for this plugin was to create a large amount of content, in order to test my React-based WordPress theme (which is still in progress).
I gave FakerPress a try, and though it's really nice, it uses lorem ipsum, and doesn't handle multilingual content.
Since I will use this theme for a WPML-powered multilingual site, I wanted to generate posts in all active languages, not only the blog's main language.
WordPress, and web development in general, have a great community of people sharing their awesome work. Thank them all! Here are the tools that helped me get started fast.
- WordPress Plugin Boilerplate Generator by Tom McFarlin and Devin Vinson
- Faker by Francois Zaninotto
- WPML, a great multilingual plugin
- Responsive Grid Generator by Graham Miller
- Super Simple Progress Bar by Stephen Fairbanks
- Async flow-control library by Caolan McMahon
This section describes how to get and install the plugin, and where to go next.
Two options are available in order to install this plugin.
-
The easy way. Since I haven't submitted it yet to the WordPress plugins repository, I made it available on my site, on this page.
a. Get the latest plugin Zip archive. b. Change directory to your WordPress's
wp-content/plugins
directory. c. Unzip it. -
The geek way: a. Change directory to your WordPress's
wp-content/plugins
directory. b. Clone this repository:git clone https://github.com/bhubr/wordpress-fake-real-text.git fake-real-text
. c. Runcomposer install
. Well, of course you know about Composer.
Then you must activate it, either from WordPress's admin extensions page, or via WP-CLI.
Once done, the plugin screen is available via the "Tools >> Fake Real Text" menu entry.
Here's how it looks in action.
- Generate posts in current site's language
- Generate posts in other languages
- Clear generated contents
- Generate comments
- Generate categories
- Translate
- Generate posts in all languages enabled in WPML
- Initial version: generate posts in blog's main locale only
-
Generate the Zip archive excluding
.git
folder:zip -x "fake-real-text/.git/*" -r fake-real-text-0.5.0.zip fake-real-text
-
How WPML works. Better explained in their docs
- When a post is created in original lang, an entry is inserted in
wp_icl_translations
table. e.g.INSERT INTO wp_icl_translations VALUES (3,'post_post',1,3,'fr',NULL);
. The first 3 value is fortranslation_id
, which is the primary key for this table. The second 3 istrid
is a key common to all the translations of one item. The 1 value (element_id
) is the id of the item to translate (here, a post ID). The last two parameters,language_code=fr
andsource_language_code=NULL
are for the target and source language codes. French is the main site language in my example, so source language code isNULL
. - Upon creating an English translation through the right-hand side "Language" panel in WP's post editor, this is what gets inserted:
INSERT INTO wp_icl_translations VALUES (4,'post_post',3,3,'en','fr');
. Now the post ID is 3 (there's been an automatic revision of my first post created in between).trid
is still 3, which makes sense, source and target languages arefr
anden
.
- When a post is created in original lang, an entry is inserted in