Hier ist eine einfache Filterfunktion in WordPress.
Ich habe den Hauptablauf dieses Codes verstanden, aber eine Sache ist nicht klar. Ich habe nicht bestanden $content
Parameter in add_filter
Funktion, aber woher kam es?Woher kommen Aktions- oder Filterparameter?
Wenn WordPress Standardparameter unterstützt, ist es in Ordnung, dann zu wissen, welche Parameter für bestimmte Filter oder Aktionsereignis möglich sind?
<?php
add_filter('the_content', 'prowp_profanity_filter');
function prowp_profanity_filter($content) {
$profanities = array('sissy', 'dummy');
$content = str_ireplace($profanities, '[censored]', $content);
return $content;
}
?>
Danke.