WordPress Developer Ukraine, Kyiv
WordPress wp_schedule_single_event(): One-Off Background Tasks with WP-Cron

WordPress wp_schedule_single_event(): One-Off Background Tasks with WP-C ...

One-off background tasks with wp_schedule_single_event() wp_schedule_event() creates tasks that repeat forever. Many tasks should run only once, at a certain time: a follow-up email a day after registration, a cleanup an hour after an import, a reminder before an event. wp_schedule_single_event() does that: it runs a hook once at the given time and removes the…
Enqueue scripts and styles correctly in WordPress

Enqueue scripts and styles correctly in WordPress

Enqueue scripts and styles correctly in WordPress Adding JavaScript and CSS with <script> and <link> tags right in header.php is one of the most common mistakes of developers who come to WordPress from static HTML. It works, but it bypasses the WordPress asset system: no dependencies (your script may run before jQuery), duplicates (a plugin…
WordPress wp_insert_term and wp_update_term: Manage Taxonomy Terms Programmatically

WordPress wp_insert_term and wp_update_term: Manage Taxonomy Terms Progr ...

Create, update and assign terms in code: wp_insert_term() and wp_set_post_terms() Imports and migrations need to create categories and other terms in code, often with a hierarchy, and then assign them to posts. WordPress has functions for both: wp_insert_term(), wp_update_term() and wp_delete_term() manage the terms, wp_set_post_terms() and wp_set_object_terms() attach them to posts. The details that matter…
Build a Custom Admin List Table in WordPress with WP_List_Table

Build a Custom Admin List Table in WordPress with WP_List_Table

Build an admin list table with WP_List_Table The lists of posts, pages, users and comments in the admin are all built with the WP_List_Table class: columns, sorting links, bulk actions, row actions, pagination. A plugin that shows its own records (form leads, log entries, imports) can extend the same class and get a screen that…