Users have recently acquired about add a list of forbidden words for post titles. If you manage a multi-author blog and want authors to avoid using certain words or phrases, then this tip would come in handy. Follow the instructions given below to do so.

Why Create a List of Forbidden Words for Post Titles in WordPress?

It is not convenient to inform all the authors on your site about your editorial style and site policies on a multi-author site.  You can use Edit Flow to leave editorial comments, add notes, and custom statuses, but it will not monitor your post title.

If the author possess publishing rights you can have all kind of unwanted words on your site which can affect the viewers. You can take these privileges away from the authors but it will mean that you will have to review and publish each post by yourself.

It is an easy job to add a list of banned words for WordPress post titles.

Adding a List of Banned Words for WordPress Post Titles

This method requires manually adding code to your website which is for advanced users who know how to paste code snippets from web into WordPress.

Simply add the following code to your theme’s functions.php file or in a site-specific plugin.

01function wpb_forbidden_title($title){


02global $post;


03$title = $post->post_title;




05// Add restricted words or phrases separated by a semicolon




07$restricted_words = “word1;word2;word3”;




09$restricted_words = explode(“;”, $restricted_words);


10foreach($restricted_words as $restricted_word){


11if (stristr( $title, $restricted_word))


12wp_die( __(‘Error: You have used a forbidden word “‘.$restricted_word .'” in post title’) );






15add_action(‘publish_post’, ‘wpb_forbidden_title’, 10, 1);


Don’t forget to add the words you want to ban in $restricted_words variable. You need to use a semicolon to separate different words and phrases.

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

Tags : wordpressWordPress how to
Nooruddin Ahmed

The author Nooruddin Ahmed

An avid football fan. Lives for the weekend game.Aviation enthusiast. Believes in letting bygones be bygones.

Leave a Response