WP-CLI Commands

Using WP-CLI you can change the Speed Optimizer plugin settings from the command prompt. Here are all available Speed Optimizer WP-CLI commands and short explanation what they do:

  • Caching:
    • wp sg optimize dynamic-cache enable|disable – enables or disables Dynamic caching rules
    • wp sg optimize file-cache enable|disable – enables or disables File caching rules
    • wp sg memcached enable|disable – enables or disables Memcached
    • wp sg optimize autoflush-cache enable|disable – enables or disables Automatic Purge cache option
    • wp sg optimize purge-rest-cache enable|disable – enables or disables Automatic Purge for WordPress API cache
    • wp sg purge (url) – purges the Dynamic, File-based and Object caches for the site or a single url (if passed)
    • wp sg optimize mobile-cache enable|disable – enables or disables Browser caching rules
  • Environment:
    • wp sg forcehttps enable|disable – enables or disables HTTPS for your site
    • wp sg optimize fix-insecure-content enable|disable – enables or disables Insecure Content Fix
    • wp sg heartbeat frontend|dashboard|post –frequency=<frequency> – Adjust Heartbeat control frequency for a specific location
    • wp sg dns-prefetch add|remove|urls <value> – add, remove or list urls in the DNS Prefetch list.
    • wp sg database-optimization enable|disable|update|status –options=<database_optimization> – enables or disables the DB Optimization, update for specific options only, show a full list of enabled options.

Available for the database-optimization options:

  • delete_auto_drafts
  • delete_revisions
  • delete_trashed_posts
  • delete_spam_comments
  • delete_trash_comments
  • expired_transients
  • optimize_tables
  • Frontend:
    • wp sg optimize css enable|disable – enables or disables CSS minification
    • wp sg optimize combine-css enable|disable – enables or disables CSS combination
    • wp sg optimize preload-combined-css enable|disable – enables or disables Preload Combined CSS
    • wp sg optimize js enable|disable – enables or disables JS minification
    • wp sg optimize combine-js enable|disable – enables or disables JS combination
    • wp sg optimize js-async enable|disable – enables or disables Defer Render-blocking JavaScript option
    • wp sg optimize html enable|disable – enables or disables HTML minification
    • wp sg optimize web-fonts enable|disable – enables or disables Web Fonts Optimization
    • wp sg optimize querystring enable|disable – enables or disables query strings removal
    • wp sg optimize emojis enable|disable – enables or disables stripping of the Emoji scripts
  • Media:
    • wp sg images –compression-level=<int> – adjusts images optimization compression level – should be set as follows: 1 for Low(25%), 2 for Medium(60%), 3 for High(85%)
    • wp sg optimize backup-media enable|disable – enables or disables Backup Media option
    • wp sg optimize webp enable|disable – enables or disables WebP image optimization
    • wp sg optimize lazyload enable|disable – enables or disables Lazy loading of images
    • wp sg optimize resize-images enable|disable – enables or disables Maximum Image Width optimization
  • Others:
    • wp sg settings export – exports the current plugin settings
    • wp sg settings import –hash=<string> – imports plugin settings and applies them
    • wp sg status (optimization option) – returns optimization current status (enabled|disabled)

Available wp sg status options

  • dynamic-cache|autoflush|browser-caching|file-cache
  • memcache
  • ssl|ssl-fix
  • database-optimization
  • html|js|css
  • combine-css|combine-js
  • js-async
  • google-fonts
  • querystring
  • emojis
  • webp
  • lazyload-images

Tutorial Menu

Share This Article