Tag Info

Hot answers tagged

3

Use tag->slug instead of tag->name. Spaces and special characters will be replaced by dashes but altering that is easy: echo str_replace('-','_',$tag->slug); Reference http://codex.wordpress.org/Function_Reference/get_the_tags http://php.net/manual/en/function.str-replace.php


2

I can see that you are constructing an array with only one element, something like this: array( 'green, yellow, red' ) instead of an array with multiple elements: array( 'green', 'yellow', 'red' ) Try to replace these lines: $out .= $tag->name .','; $csv_tags .= '"<a href="/' . $tag->slug . '">' . $tag->name . '</a>"'; with ...


2

Here you go: function get_author_post_tags_wpa78489($author_id,$taxonomy = 'post_tag'){ //get author's posts $posts = get_posts(array( 'author' => $author_id, 'posts_per_page' => -1, 'fields' => 'ids' ) ); $ts = array(); //loop over the post and count the tags foreach ((array)$posts as ...


1

If you read the Codex entry, you must pass an array as tag_slug__in. In this case though, I would use tag__in with IDs rather than slugs: $tag_ids = array(); foreach( get_the_tags($post->ID) as $tag ) { $tag_ids[] = $tag->term_id; } $recent_posts = new WP_Query( array( 'tag__in' => $tag_ids, 'posts_per_page' => 2, ...


1

When you do the following in your code $posttags = get_the_tags($item->term_id);, $item is referring to a post object, not a term object. Therefore, term_id is an invalid property. This should be throwing a PHP notice. While not certain, I think what you are intending to do is: $posttags = get_the_tags($item->ID); since get_the_tags takes a post ...


1

Double check that you don't have a check for has_excerpt() that's hiding the "auto-generated" excerpt. Even if get_the_excerpt() returns something made from post_content, has_excerpt() still returns false if the excerpt is empty. If that's not the case, see if there's a function that filters on get_the_excerpt that could be effecting this. To answer your ...



Only top voted, non community-wiki answers of a minimum length are eligible