• jrandomh

    (@jrandomh)


    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

    (@jrandomh)

    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.