You should use filter not action:
function adddd( $title, $post_id ) {
if( in_category( 30 ) ) {
$title="Prefix - " . $title . ' - xxx';
}
return $title;
}
add_filter( 'the_title', 'adddd', 10, 2 );
Related Posts:
- Add Category name to Post Title (h1)
- I want to show category in the post title , how can I do
- How do I include the category next to the title of a post?
- How to select a category automatically based on a word in WordPress post title?
- Create/Set Category as Title of Post
- Post Category link is same with Page link
- Is it possible to have different header style blog titles in different categories?
- How to display related posts from same category?
- How to show related posts by category
- Display all posts from specific categories on a page
- How to show list of posts by author and category?
- How to disable Uncategorized category URL?
- Add role that restricts user to post in specific category
- Count posts in category including child categories
- How to control which category will be picked for the slug of a post?
- Show Custom Taxonomy Categories, Listing of Posts, and Single Post via AJAX
- Archived Posts in Wrong Category
- Display all posts under child sub category in sidebar on post page?
- How do I get the slug of a custom taxonomy category of a post?
- Featured Posts for Category Pages
- Testing for post title in ‘if/else’ statement returns no content
- get_post_field – Title without paragraph
- Authors in menu, template list post by author
- Sorting posts alphabetical that have single digits
- Count to how many categories a post belongs to
- How can I remove posts of a certain category from homepage after a specified time period?
- How to display following posts titles in separate div’s on a separate webpage
- Edit custom post type admin menu link
- How to display WordPress archive into three columns [closed]
- Get mixed category random posts
- WordPress not opening posts with only numbers if permalink is post_name
- Using wp_list_categories like the the_category (showing just current categories of a post)
- Should I use posts or pages in this scenario?
- How to allow users to post only in certain category and hide elements from edit page?
- Need help with category listing!
- Prepending %category% onto default posts fails
- List all categories with featured image from post?
- How to list recent posts in a wp nav menu?
- Dynamic dependent Dropdown lists for categories, sub-categories and posts
- WordPress is replacing double minus signs in Post Title, how to disable it?
- How to display two blog categories as separate sections on one page?
- why does wordpress ignore the post args?
- Loop doesn’t show title of second post and posts thereafter
- get posts from Custom Post Type & Category
- Edit the post title from the frontend
- How to enable custom Shortcodes in Post Category Description? [duplicate]
- Sort by last word in title
- Image behind the post’s title
- How to have more than one page for your posts if you have 8 posts but can store max 4 on a page
- How to remove “» (title of post or page)”?
- Extract wordpress posts content and category content
- All categories displays the same posts
- Having pages after specifying post_type post
- Get latest post from categories
- Microformats in a single post – layout conflict
- How to show a featured image inside a post in only 1 single category
- Highlighting Current Category in the Archive and Feeds page
- Get current taxonomy and display query accordingly
- Geting error in post and category [closed]
- Display most recent posts in category with Twenty Ten theme widget
- Change modified date to current date when title updated automatically
- Display a specific category in a focused area of my site
- Does having category name in permalinks affect SEO when having a post in multiple categories?
- How to 301 redirect from url with post id to permalink with post name (slug)?
- How to display related post from same category in single.php
- Save All Post Permalink From A Specific Category into a .txt file
- Limit amount of categories displayed in a post
- show image gallery in archives or category page
- Page with Category Returning 1
- get current index of post content in category page
- 2 Domains, Same Content, Different Titles?
- Get 5 most recent categories
- Dynamically load posts based on category
- Get Categories & Posts With Type Article
- Set multi posts random categories and tags
- Add new post only in assigned category
- Changing the Category for all posts of an Author
- Admin Post List Only Show One Category
- Add category attribute to custom recent post shortcode
- Same sidebar in all posts as in the category
- How do I list categories and the common categories for posts beneath those categories?
- Latest Posts not in the right order
- Retrieve latest post by multiple categories with ID
- How to Include a common category in a custom Category Search
- How to display only one post on first category page and rest on next pages?
- Is there a way to separate wordpress titles from their posts?
- Viewing category won’t show up Custom post type posts
- How remove “recent comments” title without modifying code? [closed]
- Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]
- Listing category and its posts one by one
- Print out one of 2 post category [closed]
- How to get if category has posts?
- Show some texts in posts belonging to Specific category
- How to change Post title background size?
- Filters do not work when there are multiple (one works)
- I want the Title of page/post to show up topmost when reading the post/page
- Error counting posts of category
- Comment count next to post title?
- Display posts from a specific category on frontpage.php template?
- Cant display custom post type posts from a specific category WordPress