Skip to Main Content

How to restrict certain words in article titles WordPress

Divi: the easiest WordPress theme to use

Divi: The best WordPress theme of all time!

With over 600.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]

Recently, one of our users asked us how to add a list of forbidden words for titles on WordPress? If you manage a multi-author blog and want to avoid certain words being on the titles, then this method will be of great use to you.

In this tutorial, we will show you how to create a list of forbidden words on WordPress titles.

But before you start, take the time to take a look at How to install a WordPress theme, How many plugins to install on WordPress.

Then let's get to work!

Why create a list of prohibited words for titles of articles on WordPress?

Keeping all authors informed about your writing style and your multi-author policy is difficult. You can leave editorial comments, add custom ratings and statuses, but there's no guarantee they'll all be honored.

See also: How to create titles that attract on WordPress

If an author has editing rights, then unwanted words may appear live on your website. You can avoid this by removing the editing privilege from users, but it means more work for you because you will have to check all items.

That said, let's see how you can easily ban titles with unwanted words on your blog.

How to create a list of forbidden words for the titles of WordPress articles

This method requires you to manually add a code that you must add to your WordPress theme or WordPress Plugin. It is recommended for users who know how to paste snippets of code on WordPress.

Important : Always make a backup of your blog, when you plan to add a portion of code.

Function bpc_forbidden_title ($ title) {global $ post; $ Title = $ post-> post_title; // Add restricted words or phrases separated by a semicolon $ restricted_words = "word1; word2; word3"; $ Restricted_words = explode (";", $ restricted_words); Foreach ($ restricted_words as $ restricted_word) {if (stristr ($ title, $ restricted_word)) wp_die (__ ('Error: You have used a forbidden word.') $ Restricted_word. }} Add_action ('publish_post', 'bpc_forbidden_title', 10, 1);

Do not forget to add the words you want to prohibit in the variable “restricted_words”, separated by a semicolon.

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]

This code simply triggers a function when a user attempts to publish an article that checks the article title for the restricted words. If it finds a restricted word in the article title, it will show the user an error like this:

Error wordpress words forbidden title article

That is just about everything. Do not hesitate to ask us questions if you do not understand a point.

Discover also some premium WordPress plugins

You can use other WordPress plugins to give a modern look and optimize the grip of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. TapTap

TapTap is a premium WordPress plugin dedicated to the menu, and whose design emphasizes the use of mobile phones or smartphones. It is easy to customize and is versatile enough to be used on all websites.

Are you looking for the best WordPress themes and plugins?

Download the best plugins and WordPress themes on Envato and easily create your website. Already more than 49.720.000 downloads. [EXCLUSIVE]

Whether it's a creative portfolio or a corporate website, you'll have the ability to mix and match fonts, play with font and icon sizes, appreciate the management of letter spacing, position buttons and logos, manipulate backgrounds, alignments, animation speeds, in order to create a menu with a unique look.

Download | Demo | Web hosting

2. HT Script Pro

HT Script is a premium WordPress plugin that allows you to add elements such as: Google Analytics, Facebook Pixel, custom CSS, custom HTML, JavaScript code to the headers and footers of your website without having to change the theme WordPress.

This WordPress plugin has the ability to add any custom code to your WordPress theme, so you will not need to modify the code of the latter. This will save you time and remove the hassle that occurs when updating your WordPress theme.

See also How to install WordPress locally on a PC / Windows with XAMPP

Its main features are: very easy to use, unlimited addition of scripts, insertion of scripts on the header or footer, adding custom CSS / js in any WordPress theme, adding the coded Google Analytics, adding the Facebook Pixel code, and much more.

Download | Demo | Web hosting

3. Video gallery and Player Pro

This premium WordPress plugin adds an HTML, YouTube, Vimeo video gallery, with a wonderful popup to your WordPress blog. It displays the videos in a grid layout You can also use the identifier of a category to create several video galleries

Video gallery and Player Pro

Video gallery and Player Pro offers 15 types of design including the grid, the slider / carousel, the slider / carousel with Center mode, the video popup with slider, and many others ...

Download | Demo | Web hosting

Recommended Resources

Discover other recommended resources that will accompany you in creating and managing your website.

Easily create your Online Store

Download free WooCommerce, the best e-commerce plugins to sell your physical and digital products on WordPress. [Recommended]


Here ! That's all for this tutorial, I hope it will allow you to restrict certain words on the titles of WordPress articles. Do not hesitate to share with your friends on your favorite social networks.

However, you can also consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on WordPress blog creation.

If you have suggestions or remarks, leave them in our section Comments.


This article features 1 comment
  1. This method is just as convenient as the famous url shorteners; You know, a url shortcut can hide the initial url, avoid irritating visitors by a long link, etc. In any case, it is always better to have control of its editorial line.

Leave a comment

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top