1. Go to this page and download the library: Download hellonico/wp-cli-fixtures library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yaml
Hellonico\Fixtures\Entity\Post:
my_post:
__construct: [1] # Pass your post ID as the constructor argument
post_title: '<sentence()>'
post_content: '<paragraphs(5, true)>'
post_excerpt: '<paragraphs(1, true)>'
yaml
Hellonico\Fixtures\Entity\Post:
post{1..10}:
__construct: [<postId()>] # Use a custom formatters to return a random post ID as the constructor argument
post_title: '<sentence()>'
post_content: '<paragraphs(5, true)>'
post_excerpt: '<paragraphs(1, true)>'
yaml
Hellonico\Fixtures\Entity\Post:
post{1..30}:
post_title: <words(3, true)>
post_date: <dateTimeThisDecade()>
meta:
# number field
number: <numberBetween(10, 200)>
meta_box_custom_field: <sentence()>