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 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.
This code simply triggers a function when a user tries to publish an article which 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:
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 appearance and to optimize the handling of your blog or website.
We offer you here some premium WordPress plugins that will help you do that.
1. TapTap
TapTap is a WordPress Plugin premium dedicated to the menu, and whose design emphasizes the use of mobile phones or smartphones. It's easy to customize and is versatile enough to use on any website.
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
2.HT Script Pro
HT Script is a WordPress Plugin premium which 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 switch WordPress themes.
Ce WordPress Plugin has the ability to add any custom code to your WordPress theme, so you won't need to edit the code for it. This will save you time and remove the hassle that comes with 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 | Demo | Web 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 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.
- Sell ​​more online, 5 tips and tricks that work!
- How to share articles by PDF on WordPress
- 70 Tips for creating e-commerce website (online store) profitable
- 5 WordPress plugins to add the timeline to your articles
Conclusion
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 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.