WordPress Developer Ukraine, Kyiv
Building Custom WP-CLI Commands for Plugin Operations

Building Custom WP-CLI Commands for Plugin Operations

Custom WP-CLI commands for a plugin’s maintenance tasks Every plugin with real data sooner or later needs tasks that do not belong in the admin: re-sync 20,000 products with an API, rebuild a lookup table, clean up after a failed import. A shell script that chains wp eval calls is fragile. A WP-CLI command of…
WP-Cron Deep Dive: Reliable Scheduled Tasks in WordPress

WP-Cron Deep Dive: Reliable Scheduled Tasks in WordPress

WP-Cron in depth: reliable scheduled tasks in WordPress WP-Cron is a pseudo-cron: there is no daemon. On page loads WordPress checks the list of scheduled events (the cron option), and if one is due, it sends a non-blocking request to wp-cron.php, which runs the events in the background. On a site with constant traffic this…
Write Unit Tests for WordPress Plugins with PHPUnit and WP-CLI Scaffold

Write Unit Tests for WordPress Plugins with PHPUnit and WP-CLI Scaffold

Write unit tests for WordPress plugins with PHPUnit and WP-CLI scaffolding WordPress unit tests run against a real WordPress loaded with a separate test database. Every test runs inside a database transaction that is rolled back afterwards, so each test starts from a clean state. WP-CLI generates the whole setup, and the base class WP_UnitTestCase…