Divi: the easiest WordPress theme to use
Divi: The best WordPress theme of all time!
With over 901.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]
If you are connected to the Internet, you have a unique identification number known as an IP address. And it's no different for your visitors (each person coming to your website also has their own unique IP address).
In this tutorial, I will explore both axes. That is, after reading this tutorial, you will know how you can:
- Dynamically display each user's IP address on the front-end of your WordPress website.
- Block users based on their IP address.
But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog
Then back to why we are here.
How to display a user's IP address in WordPress
We're going to explore IP blocking, but let's start with a use that's a bit more positive:
Using WordPress to display a visitor's own IP address.
When could this be useful? Although you can still use it as a widget fun, there are also practical uses.
For example, if you are presenting code snippets where a user needs to insert their own IP address, you can use this technique to show visitors their IP address to help them solve their problem.
Similarly, you can give instructions to visitors who must enter their IP address as part of the instructions. Once again (This approach allows visitors to find their own IP address).
Although the code for creating your own shortcode is quite simple enough, there is already a lightweight plugin called " Show IP address That does exactly what you need and nothing more.
Here's how to use it:
Step 1: Install, activate and view the IP address
To begin, search for " Show IP Address On your dashboard and install the free plugin. You need to look for the Keith Griffiths plugin.
Once installed, there is really nothing to configure. As I mentioned (the plugin is incredibly lightweight) we are literally talking about a few lines of code.
But in the meantime, let's continue with the second step
Step 2: Use a "shortcode" to display users' IPs
Once you have activated the plugin, you can use the shortcode [Show_ip] to display the IP address of a user.
Easily create your website with Elementor
Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]
Want to display a user's IP address in your WordPress sidebar? Just add the shortcode to a text widget:
How to block users by IP address on WordPress
Sometimes you encounter a very specific set of bad actors on your WordPress website. It could be:
- people who spamment your comment sections
- those who perform DDoS attacks
- Malicious actions ( for example: those who visit your wp login page, even with a website with private dashboard access)
- Any other type of unwanted traffic
Part of these problems is to install a quality security plugin. Good security plugins include security measures and firewalls that will automatically block the wrong known IP addresses.
Check out our 6 Tricks to better protect your WordPress dashboard
But you might also have a situation where you need to get rid of specific IP addresses. This is what we will be talking about.
How to find the IP addresses of malicious visitors
If you already have IP addresses that you want to ban, you should go to the next section.
If you come across spam comments, finding the spammer's IP address is necessary. And WordPress actually gives you that information for every comment. All you need to do is go to the comment management page to find the IP addresses of each comment:
Finding IP addresses for other negative actors is a bit trickier. Unless you have a specific activity monitoring plugin, your best bet is normally to dig into your hosting's access reports.
For example, if your host uses cPanel, you can download a log of all your website activity by accessing the raw access logs:
You can download a traffic log for each specific website that you administer. Then, using something like "Winzip", you can open the ".gz" log file. Then, open the file that is in the .gz file with Notepad or another text editor.
At this point, you can use CTRL + F to search for people who have viewed specific pages on your website.
For example, you can check if someone other than yourself has tried to access your dashboard by searching for " wp-admin " or " wp-login "
Stop wasting time and money!
Discover the best tool to create your blog, your online store blog or any other website in just a few clicks!
In the screenshot above you can see that someone using Firefox tried to access my wp login page. I should probably block them since I'm using Google Chrome!
Start protecting your blog by discovering How to install WordFence security on WordPress
How to ban specific IP addresses from your WordPress site
When it comes to blocking specific IP addresses in order to prevent them from accessing your WordPress website, you have a few different ways of approaching the problem. Here are some of the most common:
- Using the blacklist of comments. It's part of WordPress.
- Using a plugin. As is normally the case, you can find a free WordPress plugin to help you get the job done.
- Use the IP address blocking tool on the cPanel. A server-side option for those who host WordPress websites on hosts using cPanel.
- Block specific IP addresses with the file..htaccess.
You can now block some IP addresses on your WordPress blog.
Discover also some themes and premium WordPress plugins
You can use other themes and WordPress plugins to give a modern look and optimize the grip of your blog or website.
Here are some premium WordPress plugins and themes that will help you do that.
1. Bookly PRO
Bookly Pro is a premium WordPress plugin that allows you to add to your website a fully automated online reservation system. It offers a fully customizable booking form that supports different payment gateways, notifications and synchronization with Google Calendar.
Its default configuration includes: a fFully customizable reservation form that can be used on any device, aist filterable, sortable and searchable bookings, which you can print or export to a CSV file, a nUnlimited shade of staff with individual work schedules, rates and the ability to manage their profile and booking schedule online.
You will also find a nUnlimited shadow of services that you can group into categories and set unique colors for easy viewing in Bookly Calendar, a bimportable and exportable customer base with an unlimited list of customers that displays payment statistics and internal notes on the customer.
2. Slider Revolution
Revolution Slider is an innovative and responsive carousel WordPress plugin that displays your content beautifully. Whether it's a slider or a carousel, its visual editor drag and drop will allow you to tell for example the history of your company, to highlight your best products, your best articles and more
Its features are: an excellent slide creation interface, drag and drop slide design, fully responsive layout, perfect management of multimedia content, optimized performance, multilingual support, delivered with nearly 340 graphic elements, many slide show templates available, compatibility with the majority of WordPress themes, excellent customer support, support for touch screens, free and regular updates, the documentation and video tutorials available and many more.
3. Click to WhatsApp Chat
The WordPress Click to WhatsApp Chat plugin allows WordPress customers to easily connect with the website owner or customer support using their WhatsApp account. Just one click on the WhatsApp account and it will be taken directly to your mobile WhatsApp application account with a default message.
If the customer is on a desktop or laptop, they will be redirected to WhatsApp Web. This plugin will require the WhatsApp number and time and day, which the website owner or support team will use to discuss.
The chat button can be added to the WooCommerce product details page, which is directly related to this product.
Find out about other recommended resources to help you build and manage your website.
- How to solve the problems of images encountered on WordPress
- 10 WordPress plugins to protect your blog
- How to create better keywords for your content on WordPress
- Smart Slider 3: a WordPress plugin to create sliders
Here is ! That's all for this tutorial, we hope it will allow you to better control visitor access to your website. If you liked it, don't hesitate to share with your friends on your favorite social networks.
But, in the meantime, tell us about your Comments and suggestions in the dedicated section.