_make_cat_compat( $categories[$key] );
}
- // Filter name is plural because we return alot of categories not just one
+ // Filter name is plural because we return alot of categories (possibly more than #13237) not just one
return apply_filters( 'get_the_categories', $categories );
}
$output .= $show_option_none;
}
} else {
- if( !empty( $show_option_all ) )
+ if ( ! empty( $show_option_all ) ) {
+ $posts_page = ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) ? get_permalink( get_option( 'page_for_posts' ) ) : home_url( '/' );
+ $posts_page = esc_url( $posts_page );
if ( 'list' == $style )
- $output .= '<li><a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a></li>';
+ $output .= "<li><a href='$posts_page'>$show_option_all</a></li>";
else
- $output .= '<a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a>';
+ $output .= "<a href='$posts_page'>$show_option_all</a>";
+ }
if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
$current_term_object = get_queried_object();
$tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
- if ( empty( $tags ) )
+ if ( empty( $tags ) || is_wp_error( $tags ) )
return;
foreach ( $tags as $key => $tag ) {
} else {
// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
if ( 'name' == $orderby )
- uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name, $b->name);') );
+ uasort( $tags, '_wp_object_name_sort_cb' );
else
- uasort( $tags, create_function('$a, $b', 'return ($a->count > $b->count);') );
+ uasort( $tags, '_wp_object_count_sort_cb' );
if ( 'DESC' == $order )
$tags = array_reverse( $tags, true );
}
/**
- * Callback for comparing tags based on name
+ * Callback for comparing objects based on name
*
* @since 3.1.0
* @access private
*/
-function _wp_tag_cloud_name_sort_cb( $a, $b ) {
+function _wp_object_name_sort_cb( $a, $b ) {
return strnatcasecmp( $a->name, $b->name );
}
/**
- * Callback for comparing tags based on count
+ * Callback for comparing objects based on count
*
* @since 3.1.0
* @access private
*/
-function _wp_tag_cloud_count_sort_cb( $a, $b ) {
+function _wp_object_count_sort_cb( $a, $b ) {
return ( $a->count > $b->count );
}
/**
* Retrieve the terms of the taxonomy that are attached to the post.
*
- * This function can only be used within the loop.
- *
* @since 2.5.0
*
* @param int $id Post ID. Is not optional.