[WordPress Tricks] How to Create a List of Forbidden Words for WordPress Titles

Please log in or register to like posts.
News

[WordPress Tricks] How to Create a List of Forbidden Words for WordPress Titles

WordPress Allowing The WordPress Developers To Make There Own Level Functions For There Theme. In This Tutorial I Will Show You How To Set Forbidden Word’s For Post Title. Many WordPress Website Designed And Run For The Public. There Selected Authors Or All Registered Members Can Publishing Post’s. We Know That Some Of Users Have Narrow Mind And They Want To Share Bad Words In Posts. When Peoples Write A Post With BAD Language Or Spam Word’s Your Website Will Be Down. Because Of Maximum Peoples Don’t Like The Bad Language Or Word’s To Read Similar The Girl’s. Many Bangladeshi Website Providing Public Post Permission When A User Can Be Author After Register Like Techtunes.

[ads]

If You Have The Functions That Allow You To Denied The Words Which You Don’t Want TO Publish From Post’s Title On Your WordPress Posts. You Can Call This WordPress Tricks As WordPress Black List Words Or Blocked Words. You Can Setting Think Up The Forbidden Words That Can’t Be Posting Into Your WordPress Post Title. Recently, One Of Our Users Asked Us How They Can Add a List Of Forbidden Words For WordPress Post Titles? If You Manage a Multi-author Blog And Want Authors To Avoid Using Certain Words Or Phrases, Then This tips Would Come In Handy. In this article, I Will Show You How To Create a List Of Forbidden Words For WordPress Titles.

Adding a List of Banned Words for WordPress Post Titles

First You Need To Make A List Of Words Which You Want To Denied The Post Title Words Rule. You Can Select Or Write Unlimited Words That Will Be Blocked And Never Be Use On Your WordPress Website Post Title. After Your Have A List Of Spam Words Or Forbidden Words You Are Ready To Make This Function. Go To Your WordPress Functions Theme File functions.php And Copy Past The Below Code.

function howtrick_spam_words($title){
global $post;
$title = $post->post_title;

// Add restricted words or phrases separated by a semicolon

$restricted_words = "example1;example2;example3;example4;example5";

$restricted_words = explode(";", $restricted_words);
foreach($restricted_words as $restricted_word){
if (stristr( $title, $restricted_word))
wp_die( __('Error: You have used a Spam word "'. $restricted_word .'" in post title') );
}
}
add_action('publish_post', 'howtrick_spam_words', 10, 1);

Above Code You Can Input Your Selected Forbidden Words Or Spam Words. Change Or Replace The Words That I Was Provided In This Code example1;example2;example3;example4;example5. Just Change And Add More Forbidden Words Speared By ;. 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.

Most Related WordPress Tricks

[Trick] How to Display Total Number of Registered Users
How To Show Category Related Posts When single.php WordPress Trick
CallBack Better Comments Template – Customize Comments
The WordPress Title Limit Characters Function Without Plugin
How To Change Default Role Name User Profile
How To Make WordPress Post Views Count Without Plugin
How To Highlight Author Comment Using Only CSS
10+ Most Wanted Tips, Tricks, and Hacks – HowTrick
How to Fix 404 Post Returning Error Issue

[ads]

Nobody liked ?

Leave a Reply

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