WordPress Developer Ukraine, Kyiv
Create a Custom Database Table in a WordPress Plugin with dbDelta

Create a Custom Database Table in a WordPress Plugin with dbDelta

Create a custom database table in a WordPress plugin with dbDelta wp_postmeta stores any key-value data, but for high-volume or relational plugin data (logs, statistics, bookings) it becomes a bottleneck: every value is a LONGTEXT in one huge table, and filtering by several values means several joins. A custom table gives you your own columns…
Verify Nonces and Sanitize Input in WordPress AJAX Handlers

Verify Nonces and Sanitize Input in WordPress AJAX Handlers

Verify nonces and sanitize input in WordPress AJAX handlers AJAX requests in WordPress go to admin-ajax.php, which any visitor can call. So every handler must check where the request comes from and what it contains. A CSRF attack makes the browser of a logged-in user send a forged request to your site; a nonce, a…
WordPress wp_parse_args(): Merge Function Arguments with Defaults and Recursive Deep Merge

WordPress wp_parse_args(): Merge Function Arguments with Defaults and Re ...

wp_parse_args(): merge arguments with defaults Functions with many options take one $args array instead of a long list of parameters: WP_Query, wp_nav_menu(), wp_list_comments() all work that way. The caller passes only what differs from the defaults, and inside the function wp_parse_args() fills in the rest. Your own functions, shortcodes and widgets can use the same…