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.  

Contact Form 7: Overwrite/Manipulate Posted Data Before Sending Email

Copy this code to your theme’s functions.php to manipulate the posted data by the visitor, update, add or remove fields and such. There’s a lot that you can do with it!

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 […]

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 […]