Skip to content

WP-CLI Commands

Vimeify provides WP-CLI commands for managing sync operations from the command line.

Available Commands

All Vimeify CLI commands are under the wp vimeify sync namespace.

Metadata Sync

Sync video metadata from Vimeo to WordPress.

bash
# Run metadata sync
wp vimeify sync metadata

# Reset and start from beginning
wp vimeify sync metadata --fresh

What it does:

  • Fetches video metadata from Vimeo API (100 videos per page)
  • Updates existing videos or creates new ones (based on sync settings)
  • Syncs: title, description, duration, dimensions, thumbnails, embed links
  • Updates post dates to match Vimeo upload dates

Options:

  • --fresh - Reset sync state and start from page 1

Status Sync

Check for deleted videos and remove them from WordPress.

bash
# Run status sync
wp vimeify sync status

# Reset and start from beginning
wp vimeify sync status --fresh

What it does:

  • Checks if local videos still exist on Vimeo
  • Deletes local videos that return 404 from Vimeo
  • Processes videos incrementally based on API quota

Options:

  • --fresh - Reset sync state and restart from position 0

Run All Syncs

Run both metadata and status sync in sequence.

bash
# Run all sync operations
wp vimeify sync all

# Reset both and start fresh
wp vimeify sync all --fresh

What it does:

  1. Runs metadata sync first
  2. Then runs status sync
  3. Reports results for both operations

Sync Status Info

Display information about sync state and scheduled actions.

bash
wp vimeify sync info

Output includes:

  • Scheduled Actions (next run time for each action)
  • Metadata Sync State (current page, total pages, progress %)
  • Status Sync State (current position, last synced time)
  • API calls remaining
  • Sync behavior mode (existing_only or create_all)

Example output:

=== Vimeify Sync Status ===

Scheduled Actions:
  - Metadata Sync (every 10 minutes): in 9 minutes (2025-11-23 11:55:49)
  - Status Sync (every 20 minutes): in 3 minutes (2025-11-23 11:49:39)
  - Cleanup Files (hourly): in 60 minutes (2025-11-23 12:46:53)

Metadata Sync State:
  - Page: 1 / 5 (20%)
  - API calls remaining: 249

Status Sync State:
  - Position: 142 / 500 (28.4%)
  - Last synced: 17 minutes ago

Sync Behavior:
  - Mode: Update existing videos only

Use Cases

Manual Sync After Bulk Upload

If you uploaded many videos directly to Vimeo:

bash
# Start a fresh metadata sync to import all videos
wp vimeify sync metadata --fresh

Debugging Sync Issues

Check sync status to see where it's stuck:

bash
wp vimeify sync info

Reset and retry:

bash
wp vimeify sync all --fresh

Automated Scripts

Include in deployment or maintenance scripts:

bash
#!/bin/bash
# deployment-script.sh

# Run sync after deployment
wp vimeify sync metadata

# Check status
wp vimeify sync info

Cron Jobs

While Vimeify uses Action Scheduler automatically, you can also trigger manually:

bash
# In crontab
0 */6 * * * /usr/local/bin/wp vimeify sync all --path=/var/www/html

Technical Details

Pagination

Metadata Sync:

  • Processes 100 videos per page (one Vimeo API call)
  • Saves state after each page
  • Resumes from last page on next run
  • Resets to page 1 when complete

Status Sync:

  • Loads all local videos into memory
  • Processes one video at a time (one API call per video)
  • Saves position after each video
  • Respects API quota (stops at 3 remaining calls)
  • Resets to position 0 when complete

API Quota Management

Commands automatically respect Vimeo API rate limits:

  • Stops when API calls remaining ≤ 3
  • Saves current position/page
  • Resumes on next run
  • Logs quota information

Sync Behavior Setting

The sync behavior is controlled by the admin setting:

  • Update existing videos only (existing_only): Only syncs metadata for videos already in WordPress
  • Sync all videos from Vimeo (create_all): Creates new video posts for all Vimeo videos

This applies to both manual CLI commands and automatic background sync.

Command Reference

CommandDescriptionOptions
wp vimeify sync metadataSync video metadata from Vimeo--fresh
wp vimeify sync statusCheck for deleted videos--fresh
wp vimeify sync allRun both sync operations--fresh
wp vimeify sync infoShow sync status and statsNone

Exit Codes

  • 0 - Success
  • 1 - Error (check output for details)

Logging

All sync operations are logged to:

wp-content/uploads/vimeify/cron.log

Monitor logs in real-time:

bash
tail -f wp-content/uploads/vimeify/cron.log

Examples

Full Resync

bash
# Reset both syncs and run from scratch
wp vimeify sync all --fresh

# Watch progress
watch -n 5 'wp vimeify sync info'

Integration with CI/CD

yaml
# .github/workflows/deploy.yml
- name: Sync Vimeo Videos
  run: |
    wp vimeify sync metadata --path=/var/www/html
    wp vimeify sync info --path=/var/www/html

Maintenance Mode

bash
# Stop automatic sync (via Action Scheduler admin)
# Run manual sync
wp vimeify sync all

# Check everything is synced
wp vimeify sync info

Released under the GPL-2.0 License.