I have this code, but it removes the links from all posts, I would like to introduce a variable that says that for X category it will not apply
add_filter
('the_content', 'removelink_content',1);
function removelink_content($content = '')
{
preg_match_all("#<a(.*?)>(.*?)</a>#i",$content, $matches);
$num = count($matches[0]);for($i = 0;$i < $num;$i++){
$content = str_replace($matches[0][$i] , $matches[2][$i] , $content);
}
return $content;
}
How would the code look? Is it possible to record that in the database?