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 701.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 themeHow 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 the articles.

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. '" in post title')); }} add_action ('publish_post', 'bpc_forbidden_title', 10, 1);

Don't 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 post an article that checks the article title for 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.

Taptap a super customizable wordpress mobile menu wordpress plugin

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

Download | Demo | Web hosting

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]

2. HT Script Pro

HT Script is a premium WordPress plugin that allows you to add things like: Google Analytics, Facebook Pixel, Custom CSS, Custom HTML, JavaScript code to your website headers and footers without having to change the theme WordPress.Ht script pro wordpress plugins footer booster

This WordPress plugin has the ability to add any custom code to your WordPress theme, so you won't need to modify the theme's code. This will allow you to save 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, the addition of the Facebook Pixel code, and more.

Download | DemoWeb hosting

3. Video gallery and Player Pro

This premium WordPress plugin adds HTML, YouTube, Vimeo video gallery, with a beautiful popup on your WordPress blog. It displays the videos in a grid layout.You can also use the category id to create multiple video galleries

Video gallery and Player Pro

Video gallery and Player Pro offers 15 types of design among which we find 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

Find out about other recommended resources to help you build and manage 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 it for this tutorial, I hope it allows you to restrict certain words on WordPress post titles. 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 practical as the famous url shorteners; you know, a url shortener can hide the initial url, avoid irritating visitors with too long a link, etc. In any case, it is always preferable to have control of your 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