0

I'm trying to hide certain tags from single posts pages. I've googled and found 2 codes but both are hiding the whole post page.

I'm using a theme that needs using 2 tags ticker and slider to show the posts in the ticker and the slider. When a user goes to the post page he'll see these 2 tags and other tags, it's ok to show all tags except those 2.

Any help please.

Some of the codes I found but not the solution I'm looking for.

function exclude_tags($tags) { foreach ($tags as $tag) switch ($tag->name) { case 'exclude-this-tag': case 'exclude-this-tag-too': break; default: $newtags[] = $tag; } return $newtags; } add_filter( 'get_the_tags', 'exclude_tags');

`$tags = get_tags();

foreach ($tags as $tag) { if($tag->name=='the tag i want gone') continue; echo $tag->name.', ';
}`

  • This question seems to answer your question - wordpress.stackexchange.com/questions/59081/… – Porter Apr 22 '15 at 22:31
  • @Porter thank you for the link. The code below <?php $args = array( 'smallest' => 15, 'largest' => 15, 'unit' => 'px', 'number' => 10, 'format' => 'flat', 'orderby' => 'count', 'order' => 'DESC', 'include' => $id_string, // only include stored ids 'exclude' => '29, 32', 'link' => 'view', 'echo' => true, ); wp_tag_cloud( $args ); ?> Has done the job however it's showing all tags of all posts into single. How to ask to show only related post's tags – Zaher Apr 23 '15 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.