Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Implements WP-CLI commands for managing WordPress Font Library entities (collections, families, faces) introduced in WordPress 6.5.

Implementation

Font Collections (read-only via WP_Font_Library API):

  • wp font collection list - enumerate registered collections
  • wp font collection get <slug> - fetch collection details
  • wp font collection is-registered <slug> - check if collection is registered
  • wp font collection list-families <slug> [--category=<slug>] - list font families in a collection with optional category filtering
  • wp font collection list-categories <slug> - list categories in a collection (name & slug)

Font Families (CRUD via wp_font_family post type):

  • wp font family list|get|create|update|delete
  • wp font family install <collection> <family> - install a font family from a collection (creates family post with metadata like fontFamily, preview, and automatically installs all associated font faces)

Font Faces (CRUD via wp_font_face post type):

  • wp font face list|get|create|update|delete
  • wp font face install <family-id> --src=<src> [--font-weight=<weight>] [--font-style=<style>] [--font-display=<display>] - install individual font faces with custom CSS properties
  • Validates parent family existence on create/update

All commands require WordPress 6.5+ via shared before_invoke check.

Example Usage

# List font families in a collection
$ wp font collection list-families google-fonts --category=sans-serif

# Install a complete font family from a collection
$ wp font family install google-fonts inter
Success: Installed font family "Inter" (ID: 42) with 9 font faces.

# Install an individual font face
$ wp font face install 42 --src="https://example.com/font.woff2" --font-weight=700 --font-style=normal
Success: Created font face 43.

# Create a font family manually
$ wp font family create --post_title="Inter" --porcelain
42

# Add font faces to the family
$ wp font face create --post_parent=42 --post_title="Regular"
Success: Created font face 43.

$ wp font face create --post_parent=42 --post_title="Bold"
Success: Created font face 44.

# List faces for a family
$ wp font face list --post_parent=42 --fields=ID,post_title
+----+------------+
| ID | post_title |
+----+------------+
| 43 | Regular    |
| 44 | Bold       |
+----+------------+

Structure

Commands follow existing entity-command patterns:

  • Font_Collection_Command extends WP_CLI_Command with custom API integration
  • Font_Family_Command and Font_Face_Command extend WP_CLI_Command using standard post CRUD operations
  • Behat tests cover all commands with WordPress version gating
Original prompt

This section details on the original issue you should resolve

<issue_title>Add font library commands</issue_title>
<issue_description>Introduced in WordPress 6.5, the Font Library allows users to manage fonts directly in the editor. See https://make.wordpress.org/core/2024/03/14/new-feature-font-library/

There are font collections, which contain a predefined list of font families. A font family contains one or more font faces.

We should be able to follow WP_REST_Font_Collections_Controller, WP_REST_Font_Families_Controller and WP_REST_Font_Faces_Controller for implementing CRUD functionality for these entities. If everything lives under the wp font umbrella we can do:

  • wp font collection listget (collections can't be added or deleted)
  • wp font family list|get|add|delete
  • wp font face list|get|add|delete</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits January 19, 2026 12:17
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 0% with 344 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Font_Family_Command.php 0.00% 138 Missing ⚠️
src/Font_Face_Command.php 0.00% 114 Missing ⚠️
src/Font_Collection_Command.php 0.00% 92 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
@swissspidy

This comment was marked as resolved.

…nstall)

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add font library commands

2 participants