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…
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…
Simple mail form use AJAX

Simple mail form use AJAX

A simple example of AJAX for an HTML form As they say, a developer does not live by WordPress alone. Today I will show an example of AJAX for a simple landing page built without the most popular CMS. The form sends an email without a page reload.
Customize and Style a Google Form on Your WordPress Site

Customize and Style a Google Form on Your WordPress Site

Customize a Google Form for your WordPress site Usually a contact form on WordPress is Contact Form 7 plus a plugin that saves the entries to the database, such as CFDB7. Sometimes a client prefers Google Forms, because the answers land in Google Sheets. Embedding the form as an <iframe> takes a minute, but the…