Basically what I am trying to achieve is to have title changed of posts which are in category number 30.
My code is:
function adddd($title) {
if(has_category('30',$post->ID)){
$title = 'Prefix '.$title;
}
return $title;
}
add_action('the_title','adddd');
The code works, but has one issue. When I am inside the post which has that category, title is being changed for all other pages (which are called through the_title) too.
How can I change the title only to post titles which has that category, no matter what page I am on?