Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WP CLI Commands for Image Optimization #95

Merged
merged 4 commits into from
Feb 4, 2025

Conversation

arunshenoy99
Copy link
Member

@arunshenoy99 arunshenoy99 commented Feb 1, 2025

Proposed changes

This PR introduces WP-CLI commands for managing Image Optimization settings, giving us more control over toggling features via the CLI.

It also adds a new NFD_WPCLI class, which serves as a centralized way to register commands under the nfd namespace. This will act as Newfold’s standardized layer for adding commands to WP-CLI programmatically.

Might be worth discussing how we can standardize NFD_WPCLI across other modules.

Available Commands

Structure

wp nfd performance images <command> <on|off>

Bulk Optimization

Enable or disable bulk optimization for media images.

wp nfd performance images bulk_optimization on
wp nfd performance images bulk_optimization off

Lazy Loading

Control lazy loading for images.

wp nfd performance images lazy_loading on
wp nfd performance images lazy_loading off

Auto-Optimize Uploaded Images

Automatically optimize images upon upload.

wp nfd performance images auto_optimize on
wp nfd performance images auto_optimize off

Auto-Delete Original Images

Remove the original image after optimization.

wp nfd performance images auto_delete on
wp nfd performance images auto_delete off

WebP Preference

Prioritize WebP images when an optimized version is available.

wp nfd performance images webp_preference on
wp nfd performance images webp_preference off

Toggle All Settings

Enable or disable all image optimization settings at once.

wp nfd performance images all on
wp nfd performance images all off

Type of Change

Production

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update
  • Refactoring / housekeeping (changes to files not directly related to functionality)

Development

  • Tests
  • Dependency update
  • Environment update / refactoring
  • Documentation Update

Video

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@arunshenoy99 arunshenoy99 changed the title Add WP CLI commands for Image Optimization Add WP CLI Commands for Image Optimization Feb 2, 2025
@arunshenoy99 arunshenoy99 changed the base branch from main to release/v2.6.0 February 4, 2025 13:12
@arunshenoy99 arunshenoy99 merged commit 4115bc3 into release/v2.6.0 Feb 4, 2025
8 checks passed
@arunshenoy99 arunshenoy99 deleted the enhance/image-wp-cli-commands branch February 4, 2025 13:12
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.

2 participants