Automatically Add ALT+TITLE to Images in the_content() output

This will automatically assign the ALT & TITLE attributes to <img> elements that miss those. The value will be the post title ( aka get_the_title() );  

Contact Form 7: Add Country By IP Shortcode To Email

Copy this code to your theme’s functions.php and use [country_by_ip] shortcode/tag ANYWHERE to print the visitor’s country by his IP address with CF7. It uses’s free API, detects the visitor’s IP address and adds CF7 shortcode/tag to use in the email body for example. Enjoy!

3rd Party Integration: Add Geolocation To Service Posts

Copy this code to your theme’s functions.php and each call your ‘3rd party integrations’ plugin will make after a visitor submission (For CRMs API, for example), it will include the Country, City & State of the visitor by his IP address.  

Remove HREF attribute from Empty Anchor Link on WordPress Menu

Add the following code to your theme’s functions.php file to remove the HREF attribute from all the links that link to “#”, Basically can be very useful if you’re using submenus and you want the parent item unlinked, for example.

Solved: Eliminate Render Blocking Fonts, Javascript & CSS in Google Lighthouse Speed Test

Here’s the solution for eliminate render blocking fonts, javascript and css and load non-render blocking resources warning in Google Lighthouse Speed Test. Place this code as higher as possible in your theme’s header.php, after the “<head>” tag. In this example we load 2 font families: Heebo and Assistant. Use this if you need to load […]

Add a Required Checkbox Field In WooCommerce Checkout Page

This is how you add a checkbox to checkout in Woocommerce. The Checkbox will appear in the checkout and will not let the customer to proceed unless the checkbox is checked. See also: How to add checkbox to checkout in woocommerce (not required) See also: Add Multiple Required Checkbox Fields On WooCommerce Checkout Page Add […]

WooCommerce: Don’t Add Product To Cart If Already Exists

Put it in your theme’s functions.php. Whenever your visiot will try to add a product twice mistakenly, it will keep only 1 of this product in his cart. However, he will be still able to change the quantity of the single product he has in cart.

WooCommerce: Hide Coupon On Checkout If Already Exists

This code will disable coupon on cart if it’s already applied.

WordPress Error Log 3 Code Lines Alternative with PHP

Debugging WordPress error can be sometimes a tough mission. For that, we can use that simple code to create error log file in the website’s root. Paste this into your wp-config.php: Once an error is occurred, it will create the error log file named error_log.txt with a full report of that error. Warnings will also […]