Title: Title Prepend causing Repeats
Last modified: September 1, 2016

---

# Title Prepend causing Repeats

 *  [kjgbriggs](https://wordpress.org/support/users/kjgbriggs/)
 * (@kjgbriggs)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/title-prepend-causing-repeats/)
 * After trying to add some text to the front of a post title if it has a certain
   author, the site is now pasting that text pretty much everywhere it can.
 * I am trying to set this up by using this in my CPT functions file:
 *     ```
       function show_as_tip_in_feed($title, $id) {
       	$author_id = get_post_field('post_author', get_the_ID());
       	if(get_the_author() === "Labyrith")
       	{
       		$title = '<span style="color: #2D90CC;">[Official] </span>'.$title;
       	}
       	else
       	{
       		$title = $title;
       	}
       	return $title;
       }
   
       add_filter('the_title', 'show_as_tip_in_feed', 10, 2);
       ```
   
 * The issues are that it not only pastes that text in every menu item, but it is
   also on every page, and I need a way to :
    a) Prevent it from placing itself 
   in the menu items (or anywhere but the post title for that matter). b) Make sure
   it only works on my custom post type pages.
 * Does anyone know how to do either of these?

Viewing 1 replies (of 1 total)

 *  [epicdevspace](https://wordpress.org/support/users/epicdevspace/)
 * (@epicdevspace)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/title-prepend-causing-repeats/#post-7481229)
 * Heya
 * This should do it
 *     ```
       function show_as_tip_in_feed($title, $id) {
       	$author_id = get_post_field('post_author', get_the_ID());
       	if((get_the_author() === "Labyrith") && ( in_the_loop() ))
       	{
       		$title = '<span style="color: #2D90CC;">[Official] </span>'.$title;
       	}
       	else
       	{
       		$title = $title;
       	}
       	return $title;
       }
   
       add_filter('the_title', 'show_as_tip_in_feed', 10, 2);
       ```
   
 * as for b) I need a bit more info on what you need to accomplish.
 * All the best!

Viewing 1 replies (of 1 total)

The topic ‘Title Prepend causing Repeats’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [epicdevspace](https://wordpress.org/support/users/epicdevspace/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/title-prepend-causing-repeats/#post-7481229)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
