Title: Remove classes from post_class()
Last modified: August 20, 2016

---

# Remove classes from post_class()

 *  [jrandomh](https://wordpress.org/support/users/jrandomh/)
 * (@jrandomh)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/remove-classes-from-post_class/)
 * Hi folks,
 * I’m trying to remove two classes from my post_class() output array – I don’t 
   think I’ve got it quite right, can anyone throw an eye over this and let me know
   what I’m doing wrong?
 *     ```
       function jrh_post_names($classes) {
       	$classes[] = array_diff($classes, array('tag-link', 'tag-links'));
       	return $classes;
       }
       add_filter('post_class','jrh_post_names');
       ```
   
 * I don’t want either ‘tag-link’ or ‘tag-links’ appearing in the classes list, 
   regardless of whether “link” or “links” are tags on this post.
 * TIA,
    JRH.

Viewing 1 replies (of 1 total)

 *  Thread Starter [jrandomh](https://wordpress.org/support/users/jrandomh/)
 * (@jrandomh)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/remove-classes-from-post_class/#post-2613445)
 * Here’s the fix – minor tweaks are double quotes and removal of brackets.
 *     ```
       function jrh_post_names($classes) {
       	$classes = array_diff($classes, array("tag-link", "tag-links"));
       	return $classes;
       }
       add_filter('post_class','jrh_post_names');
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Remove classes from post_class()’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [jrandomh](https://wordpress.org/support/users/jrandomh/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/remove-classes-from-post_class/#post-2613445)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
