Title: remove shared category on posts
Last modified: August 19, 2016

---

# remove shared category on posts

 *  [aldodager](https://wordpress.org/support/users/aldodager/)
 * (@aldodager)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/remove-shared-category-on-posts/)
 * hi to everyone
 * i was trying to be brief and descriptive while writing the topic but couldn’t
   found something clever to write..
 * well, i got the following problem… im creating an e-magazine and there’s a place
   where i use a category (featured) to put all the posts in that specific spot 
   of the page.. and those posts also have their own category (such as music, fitness
   and beauty and health…
 * i want to add on the top of each of those posts the category that is not “featured”…
   im using `<?php the_category(', '); ?>` but that tag posts both categories:
 * featured, music
    featured, fitness featured, beauty and health
 * and i only need to show the last one:
 * music
    fitness beauty and health
 * any ideas? im kinda new with wordpress

Viewing 1 replies (of 1 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/remove-shared-category-on-posts/#post-1176691)
 * [http://codex.wordpress.org/Function_Reference/get_the_category](http://codex.wordpress.org/Function_Reference/get_the_category)
 * In place of `<?php the_category();?>`, try using something like:
 *     ```
       <?php
       foreach((get_the_category()) as $category) {
       	if($category->cat_name == 'Fitness')  continue;
       	echo '<a href="'.get_category_link( category->ID).'">'.$category->cat_name.'</a>, ';
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘remove shared category on posts’ is closed to new replies.

## Tags

 * [the_category](https://wordpress.org/support/topic-tag/the_category/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [16 years, 9 months ago](https://wordpress.org/support/topic/remove-shared-category-on-posts/#post-1176691)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
