WordPress Developer Ukraine, Kyiv
Replace jQuery AJAX with the Fetch API and AbortController in WordPress Themes

Replace jQuery AJAX with the Fetch API and AbortController in WordPress ...

Replace jQuery AJAX with fetch() and AbortController in WordPress themes WordPress AJAX handlers still run through admin-ajax.php on the server, but the client code can drop $.ajax() for the native fetch() with async/await. Two details are specific to WordPress. The wp_send_json_*() functions report success or failure in the success field of the JSON, so checking…
Defer JavaScript and CSS Loading in WordPress to Improve Page Speed

Defer JavaScript and CSS Loading in WordPress to Improve Page Speed

Defer JavaScript and optimize CSS loading in WordPress Render-blocking JavaScript and CSS are one of the most frequent reasons for poor Lighthouse scores. A normal <script src> in the <head> stops HTML parsing until the file is downloaded and executed. The defer attribute lets the browser download the script in the background and run it…
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…