DEV Community

Sourav Pan
Sourav Pan

Posted on

Ezoic’s Objectionable Content — Problem Solved

Ezoic’s Objectionable Content refers to the types of content that violate Ezoic’s policies and may result in the termination of Ezoic services or accounts. This includes, but is not limited to, content that is illegal, promotes hate or discrimination, contains explicit sexual material, promotes violence or harm, contains malware or phishing links, or violates intellectual property rights. Ezoic has strict policies in place to ensure a safe and appropriate online environment for its users, and monitors websites for objectionable content to maintain its standards.

Here is the code i have created to solve the Ezoic’s Objectionable Content

///Content Censor code

function censor_content($content) {
// Array of words to censor
$censored_words = array(‘vagina’, ‘porn’, ‘fucking’, ‘vagina’, ‘cumshot’, ‘cock’, ‘fuck’, ‘fucked’, ‘fuck’, ‘fucking’, ‘porn’, ‘slut’, ‘fucks’, ‘cock’, ‘blowjobs’, ‘gangbang’, ‘clitoris’, ‘ejaculation’, ‘ejaculating’, ‘semen’, ‘ejaculated’, ‘orgasm’, ‘ejaculate’, ‘semen’, ‘ejaculated’, ‘ejaculation’, ‘ejaculate’, ‘duche’, ‘fuckin’, ‘orgasm’, ‘orgasms’, ‘porn’, ‘tits’, ‘semen’, ‘vagina’, ‘blowjob’, ‘buttplug’, ‘clitoris’, ‘cock’, ‘cunt’, ‘dildo’, ‘fag’, ‘feck’, ‘fellate’, ‘fellatio’, ‘felching’, ‘fuck’, ‘fudgepacker’, ‘jizz’, ‘knobend’, ‘nigger’, ‘nigga’, ‘sh1t’, ‘slut’, ‘smegma’, ‘vagina’, ‘whore’, ‘beastiality’, ‘bestiality’, ‘tits’, ‘clit’, ‘cocks’, ‘cumshot’, ‘cunnilingus’, ‘ejaculation’, ‘faggot’, ‘fuckin’, ‘fucking’, ‘gangbang’, ‘goatse’, ‘masturbate’, ‘motherfucker’, ‘orgasm’, ‘porn’, ‘semen’, ‘titties’);

// Loop through each word to censor
foreach ($censored_words as $word) {
// Create a regular expression pattern to match the word
$pattern = ‘/\b’ . $word . ‘\b/i’;

// Replace the word with censored version
$content = preg_replace_callback($pattern, function($matches) {
$word = $matches[0];
$censored_word = substr($word, 0, 2) . str_repeat(‘*’, strlen($word) — 3) . substr($word, -1);
return $censored_word;
}, $content);
}

// Return the censored content
return $content;
}

// Add the censor_content function to the WordPress content filter
add_filter(‘the_content’, ‘censor_content’);
Enter fullscreen mode Exit fullscreen mode

This code contain an array of bunch of bad words which provided by ezoic, Now, this code will automatically detect the bad words from your content and will chnage them to “Va***a”

Here is the demo you can check this content:

https://microbiologynote.com/human-male-reproductive-system/

Top comments (0)