WordPress Developer Ukraine, Kyiv
WordPress HTTP API: wp_remote_get and wp_remote_post Best Practices

WordPress HTTP API: wp_remote_get and wp_remote_post Best Practices

WordPress HTTP API: wp_remote_get() and wp_remote_post() best practices The WordPress HTTP API (wp_remote_get(), wp_remote_post(), wp_remote_request()) wraps the transport (cURL or PHP streams) in one interface with the same arguments and the same response format everywhere. Used carelessly it gives silent failures, hung pages and API rate limits; used well it needs four habits: check errors,…
Building WordPress REST API Controllers with WP_REST_Controller

Building WordPress REST API Controllers with WP_REST_Controller

REST API controllers with WP_REST_Controller A plugin’s first REST route is usually a register_rest_route() call with a closure. By the fifth route, permission checks, argument definitions and response formatting are copied around, and ?_fields= or context=edit do not work like in core routes. Core’s own endpoints are built on WP_REST_Controller, and a plugin can extend…
WordPress 6.7 Features: Font Library, Block Hooks, and HTML API

WordPress 6.7 Features: Font Library, Block Hooks, and HTML API

WordPress 6.7 for developers: template registration, block bindings UI and more WordPress 6.7 (November 2024) introduced the theme Twenty Twenty-Five and the “Zoom Out” view for building pages from patterns. For developers, the interesting changes are an API to register block templates from a plugin, the block bindings interface in the editor, automatic sizes for…
ES Modules in WordPress 6.5: wp_enqueue_script_module()

ES Modules in WordPress 6.5: wp_enqueue_script_module()

Script modules in WordPress: wp_enqueue_script_module() For a long time, WordPress could only load classic scripts. Writing import and export in a theme meant a bundler, or a script_loader_tag filter that added type="module" by hand, with no way to share modules between plugins. WordPress 6.5 added the Script Modules API: modules are registered with an ID,…
Block Navigation in WordPress: Converting Classic Menus

Block Navigation in WordPress: Converting Classic Menus

From classic menus to the Navigation block in a block theme A classic theme registers menu locations and prints them with wp_nav_menu(); the menus are edited in Appearance → Menus. A block theme has no menu locations: the header template part contains a Navigation block, and the menu items are stored in a wp_navigation post.…
WordPress Interactivity API: Reactive Blocks Without React

WordPress Interactivity API: Reactive Blocks Without React

The WordPress Interactivity API: interactive blocks without React on the front end Blocks are built with React in the editor, but on the front end they are static HTML. For an accordion, a tab group or a “show more” button, every block author used to write their own vanilla JavaScript or ship a framework. Since…
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…
Custom Post Statuses for Editorial Workflows in WordPress

Custom Post Statuses for Editorial Workflows in WordPress

Custom post statuses for an editorial workflow in WordPress WordPress has one step between draft and published: “Pending Review”. A newsroom often needs more: an editor sends a text back for revision or marks it as approved, and somebody else schedules it. register_post_status() adds such statuses, but the function has a known gap: the block…