How to send AJAX requests in a WordPress theme or plugins

AJAX enables tasks such as fetching, inserting and deleting records from a MySQL database, as well as file uploading. AJAX sent URL should be admin-ajax.php. wp_ajax action hooks. Here are well-explained tutorials from Yogesh Singh on how to send AJAX requests from a WordPress theme and a WordPress plugin:

Looks like somethings gone wrong. Wait a couple seconds, and then try again.

Looks like something’s gone wrong. Wait a couple seconds, and then try again.

When editing the menu in customizer the changes failed to save with the error message: Looks like something’s gone wrong. Wait a couple seconds, and then try again. And when inspecting the page the following error appears: POST http://plugins.club/wp-admin/admin-ajax.php 403 (Forbidden) The 403 error is caused by something blocking access to the file such as … Read more

How to add text before price in WooCommerce

To put a string before the price of WooCommerce product and cart pages, use the WooCommerce filters woocommerce_cart_item_price and woocommerce_get_price_html Add the following code to your active theme functions.php file. Make sure to change <span class=”price-prefix”>TEXT BEFORE THE PRICE</span> with your text or HTML code. NEXT: How to Add text after the price in WooCommerce

How to add text after price in WooCommerce

To put a string after the price of WooCommerce product and cart pages, use the WooCommerce filters woocommerce_cart_item_price and woocommerce_get_price_html Add the following code to your active theme functions.php file. Make sure to change <span class=”price-suffix”>TEXT AFTER THE PRICE</span> with your text or HTML code. NEXT: How to Add text before the price in WooCommerce

How to add the | separator back in Yoast SEO plugin

The pipe ( | ) and tilde ( ~ ) separators are removed from Yoast SEO plugin 17.1. It was done because Google routinely alters these symbols in search results, according to Yoast: https://yoast.com/yoast-seo-17-1 To add these separators back to yoastSEO plugin, simply add the following inside your active theme function.php file: and under Search … Read more

5 Easy ways to Create a WordPress Admin user

Here are five different methods to create a new WordPress Admin user. In all of the examples below I will use the following username/password combination, so make sure to change it before running any of the commands: username123 change username123 with your username password123 change password123 with your password [email protected] change [email protected] with your email … Read more

Yoast SEO is (kind of) incompatible with PHP8

Yoast SEO is compatible with PHP 8 and PHP 8.1 but the Composer that YoastSEO is using doesn’t yes support PHP 8.0 so you might experience problems when editing posts&pages in WordPress. According to this comment there are still 19 other PHP version incompatibilities remaining to be fixed. 😲 So turns out that YoastSEO is … Read more

How to move WordPress pages to the Domain Root

I have a WordPress blog on pcelarstvopejcic.com/blog and a few pages that I would like to move to the domain document root, so that: pcelarstvopejcic.com/blog/contact becomes pcelarstvopejcic.com/contact pcelarstvopejcic.com/blog/shop becomes pcelarstvopejcic.com/shop So this way I only have one WP installation and blog posts would be accessible via pcelarstvopejcic.com/blog/POST and pages in pcelarstvopejcic.com/PAGE To do this, edit … Read more

Display template name in WP admin bar

Figuring out templates that are being used while you are building and developing a custom WordPress website can be problematic. Using the following snippets you can quickly and easily display template name or full path to the file in your wp-admin bar. Display Template name To display just template name add the following to functions.php … Read more

Convert WordPress to Markdown

Export WordPress posts to XML an then convert it into Markdown files suitable for a static site generator such as Gridsome, Gatsby, Hugo, Jekyll, etc. Step 1. Export WordPress to XML Navigate to Tools > Export and Select “All Content” File will be saved as [website].WordPress. [DATE].xml Step 3. Install NodeJS & Git Make sure … Read more