How to edit specific title instead of all the title calls

There are several ways to achieve this, none of them elegant. That’s because there is no general way to know exactly where get_the_title was called.

(1) Not completely foolproof, but possibly enough in your scenario would be to add is_main_query to your conditions. That would rule out titles generated in secondary loops. However, if the breadcrumb is generated inside the loop, this would obviously not work.

(2) You could use debug_backtrace to find which template file called get_the_title and add this being single.php as a condition. Assuming the theme uses such a template. Also assuming there is no secondary loop in this template.

(3) You could skip the filter on the server side and convert your code to a piece of javascript that detects the presence of a certain class and insert the html on the user end.

tech