Skip to content

Commit

Permalink
feat: Add custom_fields method to SeedPostsCommand for seeding dummy …
Browse files Browse the repository at this point in the history
…meta fields
  • Loading branch information
alessandrotesoro committed May 19, 2024
1 parent 833bd26 commit 9addad3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/SeedPostsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,23 @@ private function create_post() {
return $post_id;
}

/**
* Seed the database with dummy meta fields.
*
* @param array $args Command arguments.
* @param array $assoc_args Command associative arguments.
* @return void
*/
public function custom_fields( $args, $assoc_args ) {
$post_type = search(
'Which post type do you want to seed?',
fn ( string $value ) => strlen( $value ) > 0
? PostTypes::get_post_types_for_dropdown( $value )
: []
);

$this->set_post_type( $post_type );

parent::custom_fields( $args, $assoc_args );
}
}

0 comments on commit 9addad3

Please sign in to comment.