Skip to content

Conversation

costdev
Copy link
Member

@costdev costdev commented Jun 5, 2025

This adds a WP-CLI command for importing patterns from JSON files.

Commands:

wp fair_patterns create_categories # Create the pattern categories, if missing, from a hardcoded list.
wp fair_patterns create_keywords # Create the pattern categories, if missing, from a hardcoded list.
wp fair_patterns import <dir> # Import patterns from a directory of JSON files.

For example:

  • Ensure the Pattern Directory plugin is installed and activated.
  • Get patterns from this endpoint
    • Change page until out of pages.
    • Save each set of results to a JSON file in a /path/to/patterns directory.
  • Run wp fair_patterns create_categories to create the pattern categories.
  • Run wp fair_patterns create_keywords to create the pattern keywords.
  • Run wp fair_patterns import /path/to/patterns to import the patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant