WordPress – How to Restrict Posts by IP Address

In this post, we’ll show you how to restrict WordPress posts by IP address. You can easily create restricted content or personalized content for your WordPress site.

For example, you can create a complete series of posts that you want your team to have access only. In this case, you need to restrict your posts by IP address.

You can restrict posts by IP address with a few simple clicks, using the WordPress Conditional Post Restrictions plugin.

This WordPress plugin allows you to restrict any type of WordPress content: posts, pages, courses, events, recipes, downloads, products, donations, forums, and any other custom post type generated by any WordPress plugin.

You can download the plugin here:

Download WordPress Conditional Post Restrictions Plugin - or - Read more

Once installed and activated, follow these steps to restrict WordPress posts by IP address. We’ll show you how to restrict all posts, a specific post category, or a single post.

1- Restrict WordPress posts by IP address globally

If you want to definitely restrict all posts by IP address, you need to follow these simple steps:

  1. Go to Settings > Post restrictions.
  2. Tick the Enable conditions checkbox.
  3. Click Add Condition to create a new restriction.

ban ip address from reading posts

Now you need to select these values to restrict posts by IP address:

ban ip address from reading posts

  • Select post types: Posts
  • What happens when the conditions are met: Restrict access or Allow Access
    • Restrict access means users from this IP address won’t be granted access to your posts.
    • Allow Access means only users from this IP address will be granted access to your posts.
  • Condition 1: IP = 105.30.167.41
    • If you want to add more IP addresses, click Add ‘Or’ group, and repeat the values, just changing the IP address.
  • Publish the condition.

With this restriction, the selected IP address will be banned from your WordPress posts or granted exclusive access.

2- How to restrict an entire category by IP address

If you don’t want to globally restrict posts by IP address, you can partially restrict them by applying a conditional restriction to a post category. Just follow these simple steps:

  1. Go to Posts > Categories in wp-admin.
  2. Open a category you want to edit.

ban ip address from reading posts

Once you open the category you’ll edit, scroll down to the Restriction rules section and select these values:

ban ip address from reading posts

  • Enable the conditional restrictions: Yes
  • Apply restrictions to: Category and posts
  • What happens when the conditions are met: Restrict access or Allow Access
    • Restrict access means users from this IP address won’t be granted access to your posts.
    • Allow Access means only users from this IP address will be granted access to your posts.
  • Condition 1: IP = 105.30.167.41
    • If you want to add more IP addresses, click Add ‘Or’ group, and repeat the values, just changing the IP address.
  • Update the category to save the changes.

Once you apply this restriction to the category, the selected IP address will be banned or granted exclusive access to your WordPress posts.

3- How to restrict WordPress posts by IP address individually

You can even restrict your posts by IP addresses individually. You just need to follow these simple steps:

  1. Go to Posts in wp-admin.
  2. Open a post you want to restrict for the selected IP address.
  3. Scroll down to the Restriction rules section.

Once you open the post you’ll edit and are on the Restriction rules section, select the following values:

ban ip address from reading posts

  • Enable the content restrictions: Yes
  • What happens when the conditions are met: Restrict access or Allow Access
    • Restrict access means users from this IP address won’t be granted access to your posts.
    • Allow Access means only users from this IP address will be granted access to your posts.
  • Condition 1: IP = 105.30.167.41
    • If you want to add more IP addresses, click Add ‘Or’ group, and repeat the values, just changing the IP address.
  • Publish the condition.

This is how you can easily ban or allow IP addresses from a specific post in WordPress. To restrict other posts individually, repeat the same steps in this section on all the posts you want to restrict.

4- What will the user see when he’s banned from reading posts?

You have several options to decide what the users will see when their IP address is banned from reading posts.

Open the plugin’s global settings at Settings > Post Restrictions.

Once there, you’ll see these fields and options:

ban ip address from reading posts

  • Enable restrictions: Tick/untick this checkbox to enable/disable the global conditions.
  • Don’t apply restrictions for these user roles: You’ll see a list of user roles for which the conditions won’t be applied. By default, we will not apply restrictions for administrators, editors, and any user with the capability edit_others_posts.
  • What happens when the post is restricted? You have several options to select what happens when the post is restricted:
    • Redirect to URL
    • Remove the content and show a message
    • Show fragment of the content and show message after fragment
  • What happens when a category is restricted? You have several options to select what happens when the post is restricted:
    • Show error 404
    • Show the normal page without posts
    • Show an error message
    • Redirect to another URL
    • Show the content of another page

Once you select the global settings, just save the changes.

Really simple!

Restricting WordPress content by IP address is really simple!

You don’t need to program anything nor hire a professional programmer.

You can do it really quickly with the WordPress Conditional Post Restrictions plugin.

You can download the plugin here:

Download WordPress Conditional Post Restrictions Plugin - or - Read more

Close Menu