Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Font Library Commands Implementation

Overview

This PR adds WP-CLI commands for managing the WordPress Font Library (introduced in WordPress 6.5), covering font collections, families, and faces.

Commands Implemented

Font Collections

  • wp font collection list - List all registered collections
  • wp font collection get <slug> - Get 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, optionally filtered by category
  • wp font collection list-categories <slug> - List categories in a collection

Font Families (CRUD)

  • wp font family list - List all font families
  • wp font family get <id> - Get family details
  • wp font family create --post_title=<title> - Create new family
  • wp font family update <id> - Update existing family
  • wp font family delete <id>... - Delete font families
  • wp font family install <collection> <family> - Install a font family from a collection (creates family + all font faces)

Font Faces (CRUD)

  • wp font face list - List all font faces
  • wp font face get <id> - Get face details
  • wp font face create --post_parent=<id> --post_title=<title> - Create new face
  • wp font face update <id> - Update existing face
  • wp font face delete <id>... - Delete font faces
  • wp font face install <family-id> --src=<src> [options] - Install a font face with custom parameters

Implementation Details

  • All commands require WordPress 6.5+ (enforced via shared before_invoke hook)
  • Font families and faces use custom post types (wp_font_family, wp_font_face)
  • Font collections use the WordPress Font Library API (WP_Font_Library)
  • Follows existing patterns in entity-command package
  • Comprehensive Behat tests for all commands including new additions
  • All code quality checks pass (linting, PHPCS, PHPStan, PHPUnit)

Behat Tests Coverage

✅ Font collection list-families command
✅ Font collection list-families with category filtering
✅ Font collection list-categories command
✅ Font family install command from collection
✅ Font face install command with custom properties
✅ Error handling for invalid collections, families, and parameters
✅ WordPress version gating (6.5+ required)

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 358 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Font_Family_Command.php 0.00% 143 Missing ⚠️
src/Font_Face_Command.php 0.00% 119 Missing ⚠️
src/Font_Collection_Command.php 0.00% 96 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.

@swissspidy

This comment was marked as resolved.

This comment was marked as resolved.

@swissspidy
Copy link
Member

@copilot you should really add behat tests for those new additions

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