Add comprehensive headless WordPress and Faust.js support to CF Images plugin#2
Open
Add comprehensive headless WordPress and Faust.js support to CF Images plugin#2
Conversation
Co-authored-by: cpritchett <3866278+cpritchett@users.noreply.github.com>
…dPress support Co-authored-by: cpritchett <3866278+cpritchett@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Research: evaluate for headless support
Add comprehensive headless WordPress and Faust.js support to CF Images plugin
Sep 25, 2025
cpritchett
approved these changes
Sep 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements comprehensive support for headless WordPress setups, particularly those using the Faust.js framework. The CF Images plugin can now seamlessly deliver optimized images through Cloudflare in headless environments where WordPress serves as a backend CMS and modern JavaScript frameworks handle the frontend.
Problem Statement
Headless WordPress setups use frameworks like Faust.js, Next.js, and Nuxt.js to build frontends that consume WordPress data via REST API and GraphQL endpoints. However, the CF Images plugin previously blocked image processing during REST API requests, preventing headless sites from benefiting from Cloudflare image optimization.
Solution
Core Integration (
app/integrations/class-faust.php)Added a comprehensive Faust.js integration that:
Key Features Implemented
REST API Enhancement: The integration intelligently overrides the default REST request blocking to allow image processing for headless setups:
Content Processing: Automatically processes images within post content delivered via REST API:
ACF Integration: Enhanced support for Advanced Custom Fields in headless contexts:
Configuration Options
The integration provides four configurable options through the CF Images admin interface:
Frontend Framework Support
Works seamlessly with popular headless WordPress frameworks:
Next.js with Faust.js:
Direct REST API consumption:
Testing & Validation
Comprehensive Test Suite (
tests/test-faust-integration.php)Validation Script (
validate-headless-integration.php)Provides automated health checks for:
Documentation
Setup Guide (
HEADLESS_SETUP.md)Complete documentation covering:
Usage Examples (
EXAMPLE_USAGE.md)Real-world implementation examples for:
Backward Compatibility
This implementation maintains 100% backward compatibility. Existing WordPress installations continue to work exactly as before, while headless setups automatically gain Cloudflare image optimization capabilities.
Benefits
This enhancement positions the CF Images plugin as the premier solution for modern WordPress architectures, supporting both traditional and headless implementations with industry-leading image optimization.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.