function addLolToTitle( $title, $id = null ) { if ( in_category('lol', $id ) ) { return $title . ' lol !'; } return $title; } add_filter( 'the_title', 'addLolToTitle', 10, 2 );