WordPress Developer Ukraine, Kyiv
Configure Content Security Policy Headers for WordPress

Configure Content Security Policy Headers for WordPress

Configure a Content Security Policy for WordPress A Content Security Policy (CSP) header tells the browser which sources a page may load scripts, styles, images, fonts and frames from, and whether inline scripts may run. With a strict policy, an XSS injection that slips through cannot run its script, because the browser refuses it. The…
Run Custom SQL Queries in WordPress with $wpdb->prepare and get_results

Run Custom SQL Queries in WordPress with $wpdb->prepare and get_results

Run custom SQL queries in WordPress with $wpdb->prepare() and get_results() WP_Query covers most needs, but some queries it cannot express or makes inefficient: aggregations with GROUP BY, joins across several tables, bulk updates. For those, WordPress gives the $wpdb object, a direct connection to the database, with $wpdb->prepare() for safe parameters.
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…