Ticket #12891: 12891.4.diff
File 12891.4.diff, 19.8 KB (added by , 14 years ago) |
---|
-
wp-includes/taxonomy.php
23 23 'public' => true, 24 24 'show_ui' => true, 25 25 '_builtin' => true, 26 ) ) 26 ) ); 27 27 28 28 register_taxonomy( 'post_tag', 'post', array( 29 29 'hierarchical' => false, 30 30 'update_count_callback' => '_update_post_term_count', 31 'query_var' => false,31 'query_var' => 'tag', 32 32 'rewrite' => false, 33 33 'public' => true, 34 34 'show_ui' => true, … … 432 432 * @uses $wpdb 433 433 * @uses wp_parse_args() Creates an array from string $args. 434 434 * 435 * @param int|array $term_ids Term id or array of term ids of terms that will be used435 * @param mixed $terms Term id/slug/name or array of such to match against 436 436 * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names 437 * @param array|string $args Change the order of the object_ids, either ASC or DESC 438 * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success 439 * the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found. 437 * @param array|string $args 438 * 'include_children' bool Wether to include term children (hierarchical taxonomies only) 439 * 'field' string Which term field is being used. Can be 'term_id', 'slug' or 'name' 440 * 'operator' string Can be 'IN' and 'NOT IN' 441 * 'do_query' bool Wether to execute the query or return the SQL string 442 * 443 * @return WP_Error If the taxonomy does not exist 444 * @return array The list of found object_ids 445 * @return string The SQL string, if do_query is set to false 440 446 */ 441 function get_objects_in_term( $term _ids, $taxonomies, $args = array() ) {447 function get_objects_in_term( $terms, $taxonomies, $args = array() ) { 442 448 global $wpdb; 443 449 444 if ( ! is_array( $term_ids ) ) 445 $term_ids = array( $term_ids ); 450 extract( wp_parse_args( $args, array( 451 'include_children' => false, 452 'field' => 'term_id', 453 'operator' => 'IN', 454 'do_query' => true, 455 ) ), EXTR_SKIP ); 446 456 447 if ( ! is_array( $taxonomies ) ) 448 $taxonomies = array( $taxonomies ); 457 $taxonomies = (array) $taxonomies; 449 458 450 foreach ( (array)$taxonomies as $taxonomy ) {459 foreach ( $taxonomies as $taxonomy ) { 451 460 if ( ! taxonomy_exists( $taxonomy ) ) 452 return new WP_Error( 'invalid_taxonomy', __( 'Invalid Taxonomy') );461 return new WP_Error( 'invalid_taxonomy', sprintf( __( 'Invalid Taxonomy: %s' ), $taxonomy ) ); 453 462 } 454 463 455 $ defaults = array( 'order' => 'ASC');456 $args = wp_parse_args( $args, $defaults );457 extract( $args, EXTR_SKIP );464 $terms = array_unique( (array) $terms ); 465 if ( empty($terms) ) 466 continue; 458 467 459 $order = ( 'desc' == strtolower( $order ) ) ? 'DESC' : 'ASC'; 468 if ( !in_array( $field, array( 'term_id', 'slug', 'name' ) ) ) 469 $field = 'term_id'; 460 470 461 $term_ids = array_map('intval', $term_ids ); 471 if ( !in_array( $operator, array( 'IN', 'NOT IN' ) ) ) 472 $operator = 'IN'; 462 473 463 474 $taxonomies = "'" . implode( "', '", $taxonomies ) . "'"; 464 $term_ids = "'" . implode( "', '", $term_ids ) . "'";465 475 466 $object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order"); 476 switch ( $field ) { 477 case 'term_id': 478 $terms = array_map( 'intval', $terms ); 467 479 468 if ( ! $object_ids ) 469 return array(); 480 if ( is_taxonomy_hierarchical( $taxonomy ) && $include_children ) { 481 $children = $terms; 482 foreach ( $terms as $term ) 483 $children = array_merge( $children, get_term_children( $term, $taxonomy ) ); 484 $terms = $children; 485 } 470 486 471 return $object_ids; 487 $terms = implode( ',', $terms ); 488 $sql = " 489 SELECT object_id 490 FROM $wpdb->term_relationships 491 INNER JOIN $wpdb->term_taxonomy USING (term_taxonomy_id) 492 WHERE taxonomy IN ($taxonomies) 493 AND term_id $operator ($terms) 494 "; 495 break; 496 497 case 'slug': 498 case 'name': 499 foreach ( $terms as $i => $term ) { 500 $terms[$i] = sanitize_term_field('slug', $term, 0, $taxonomy, 'db'); 501 } 502 $terms = array_filter($terms); 503 504 $terms = "'" . implode( "','", $terms ) . "'"; 505 $sql = " 506 SELECT object_id 507 FROM $wpdb->term_relationships 508 INNER JOIN $wpdb->term_taxonomy USING (term_taxonomy_id) 509 INNER JOIN $wpdb->terms USING (term_id) 510 WHERE taxonomy IN ($taxonomies) 511 AND $field $operator ($terms) 512 "; 513 break; 514 } 515 516 if ( !$do_query ) 517 return $sql; 518 519 return $wpdb->get_col( $sql ); 472 520 } 473 521 522 /* 523 * Retrieve object_ids matching one or more taxonomy queries 524 * 525 * @since 3.1.0 526 * 527 * @param array $queries A list of taxonomy queries. A query is an associative array: 528 * 'taxonomy' string|array The taxonomy being queried 529 * 'terms' string|array The list of terms 530 * 'field' string Which term field is being used. Can be 'term_id', 'slug' or 'name' 531 * 'operator' string Can be 'IN' and 'NOT IN' 532 * 533 * @return array|WP_Error List of matching object_ids; WP_Error on failure. 534 */ 535 function wp_tax_query( $queries ) { 536 global $wpdb; 537 538 $sql = array(); 539 foreach ( $queries as $query ) { 540 if ( !isset( $query['include_children'] ) ) 541 $query['include_children'] = true; 542 $query['do_query'] = false; 543 $sql[] = get_objects_in_term( $query['terms'], $query['taxonomy'], $query ); 544 } 545 546 if ( 1 == count( $sql ) ) 547 return $wpdb->get_col( $sql[0] ); 548 549 $r = "SELECT object_id FROM $wpdb->term_relationships WHERE 1=1"; 550 foreach ( $sql as $query ) 551 $r .= " AND object_id IN ($query)"; 552 553 return $wpdb->get_col( $r ); 554 } 555 474 556 /** 475 557 * Get all Term data from database by Term ID. 476 558 * -
wp-includes/theme.php
813 813 * @return string 814 814 */ 815 815 function get_tag_template() { 816 $tag_id = absint( get_query_var('tag_id') ); 817 $tag_name = get_query_var('tag'); 816 global $wp_query; 818 817 818 $tag = $wp_query->get_queried_object(); 819 $tag_name = $tag->slug; 820 $tag_id = $tag->term_id; 821 819 822 $templates = array(); 820 823 821 824 if ( $tag_name ) -
wp-includes/query.php
662 662 var $query_vars = array(); 663 663 664 664 /** 665 * Taxonomy query, after parsing 666 * 667 * @since 3.1.0 668 * @access public 669 * @var array 670 */ 671 var $tax_query = array(); 672 673 /** 665 674 * Holds the data for a single object that is queried. 666 675 * 667 676 * Holds the contents of a post, page, category, attachment. … … 1528 1537 1529 1538 // First let's clear some variables 1530 1539 $distinct = ''; 1531 $whichcat = '';1532 1540 $whichauthor = ''; 1533 1541 $whichmimetype = ''; 1534 1542 $where = ''; … … 1785 1793 // Allow plugins to contextually add/remove/modify the search section of the database query 1786 1794 $search = apply_filters_ref_array('posts_search', array( $search, &$this ) ); 1787 1795 1788 // Category stuff 1796 // Taxonomies 1797 $tax_query = array(); 1789 1798 1790 if ( empty($q['cat']) || ($q['cat'] == '0') || 1791 // Bypass cat checks if fetching specific posts 1792 $this->is_singular ) { 1793 $whichcat = ''; 1794 } else { 1799 if ( $this->is_tax ) { 1800 foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { 1801 if ( $t->query_var && !empty( $q[$t->query_var] ) ) { 1802 $tax_query_defaults = array( 1803 'taxonomy' => $taxonomy, 1804 'field' => 'slug', 1805 'operator' => 'IN' 1806 ); 1807 1808 $term = str_replace( ' ', '+', $q[$t->query_var] ); 1809 1810 if ( strpos($term, '+') !== false ) { 1811 $terms = preg_split( '/[+\s]+/', $term ); 1812 foreach ( $terms as $term ) { 1813 $tax_query[] = array_merge( $tax_query_defaults, array( 1814 'terms' => array( $term ) 1815 ) ); 1816 } 1817 } else { 1818 $tax_query[] = array_merge( $tax_query_defaults, array( 1819 'terms' => preg_split('/[,\s]+/', $term) 1820 ) ); 1821 } 1822 } 1823 } 1824 } 1825 1826 // Category stuff 1827 if ( !empty($q['cat']) && '0' != $q['cat'] && !$this->is_singular ) { 1795 1828 $q['cat'] = ''.urldecode($q['cat']).''; 1796 1829 $q['cat'] = addslashes_gpc($q['cat']); 1797 1830 $cat_array = preg_split('/[,\s]+/', $q['cat']); … … 1804 1837 $cat = abs($cat); 1805 1838 if ( $in ) { 1806 1839 $q['category__in'][] = $cat; 1807 $q['category__in'] = array_merge($q['category__in'], get_term_children($cat, 'category'));1808 1840 } else { 1809 1841 $q['category__not_in'][] = $cat; 1810 $q['category__not_in'] = array_merge($q['category__not_in'], get_term_children($cat, 'category'));1811 1842 } 1812 1843 } 1813 1844 $q['cat'] = implode(',', $req_cats); 1814 1845 } 1815 1846 1816 1847 if ( !empty($q['category__in']) ) { 1817 $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) "; 1818 $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'category' "; 1819 $include_cats = "'" . implode("', '", $q['category__in']) . "'"; 1820 $whichcat .= " AND $wpdb->term_taxonomy.term_id IN ($include_cats) "; 1848 $tax_query[] = array( 1849 'taxonomy' => 'category', 1850 'terms' => $q['category__in'], 1851 'operator' => 'IN', 1852 'field' => 'term_id' 1853 ); 1821 1854 } 1822 1855 1823 1856 if ( !empty($q['category__not_in']) ) { 1824 $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; 1825 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN ($cat_string) )"; 1857 $tax_query[] = array( 1858 'taxonomy' => 'category', 1859 'terms' => $q['category__not_in'], 1860 'operator' => 'NOT IN', 1861 'field' => 'term_id' 1862 ); 1826 1863 } 1827 1864 1828 1865 // Category stuff for nice URLs … … 1851 1888 1852 1889 $q['cat'] = $reqcat; 1853 1890 1854 $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) "; 1855 $whichcat = " AND $wpdb->term_taxonomy.taxonomy = 'category' "; 1856 $in_cats = array($q['cat']); 1857 $in_cats = array_merge($in_cats, get_term_children($q['cat'], 'category')); 1858 $in_cats = "'" . implode("', '", $in_cats) . "'"; 1859 $whichcat .= "AND $wpdb->term_taxonomy.term_id IN ($in_cats)"; 1860 $groupby = "{$wpdb->posts}.ID"; 1891 $tax_query[] = array( 1892 'taxonomy' => 'category', 1893 'terms' => array( $q['cat'] ), 1894 'operator' => 'IN', 1895 'field' => 'term_id' 1896 ); 1861 1897 } 1862 1898 1863 // Tags 1864 if ( '' != $q['tag'] ) { 1865 if ( strpos($q['tag'], ',') !== false ) { 1866 $tags = preg_split('/[,\s]+/', $q['tag']); 1867 foreach ( (array) $tags as $tag ) { 1868 $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db'); 1869 $q['tag_slug__in'][] = $tag; 1870 } 1871 } else if ( preg_match('/[+\s]+/', $q['tag']) || !empty($q['cat']) ) { 1872 $tags = preg_split('/[+\s]+/', $q['tag']); 1873 foreach ( (array) $tags as $tag ) { 1874 $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db'); 1875 $q['tag_slug__and'][] = $tag; 1876 } 1877 } else { 1878 $q['tag'] = sanitize_term_field('slug', $q['tag'], 0, 'post_tag', 'db'); 1879 $q['tag_slug__in'][] = $q['tag']; 1880 } 1899 // Tag stuff 1900 if ( !empty($qv['tag_id']) ) { 1901 $tax_query[] = array( 1902 'taxonomy' => 'post_tag', 1903 'terms' => $qv['tag_id'], 1904 'operator' => 'IN', 1905 'field' => 'term_id' 1906 ); 1881 1907 } 1882 1908 1883 if ( !empty($q['category__in']) || !empty($q['meta_key']) || !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) { 1884 $groupby = "{$wpdb->posts}.ID"; 1909 if ( !empty($q['tag__in']) ) { 1910 $tax_query[] = array( 1911 'taxonomy' => 'post_tag', 1912 'terms' => $q['tag__in'], 1913 'operator' => 'IN', 1914 'field' => 'term_id' 1915 ); 1885 1916 } 1886 1917 1887 if ( !empty($q['tag__in']) && empty($q['cat']) ) {1888 $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";1889 $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";1890 $include_tags = "'" . implode("', '", $q['tag__in']) . "'";1891 $whichcat .= " AND $wpdb->term_taxonomy.term_id IN ($include_tags) ";1892 $reqtag = term_exists( $q['tag__in'][0], 'post_tag' );1893 if ( !empty($reqtag) )1894 $q['tag_id'] = $reqtag['term_id'];1895 }1896 1897 if ( !empty($q['tag_slug__in']) && empty($q['cat']) ) {1898 $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) INNER JOIN $wpdb->terms ON ($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) ";1899 $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";1900 $include_tags = "'" . implode("', '", $q['tag_slug__in']) . "'";1901 $whichcat .= " AND $wpdb->terms.slug IN ($include_tags) ";1902 $reqtag = get_term_by( 'slug', $q['tag_slug__in'][0], 'post_tag' );1903 if ( !empty($reqtag) )1904 $q['tag_id'] = $reqtag->term_id;1905 }1906 1907 1918 if ( !empty($q['tag__not_in']) ) { 1908 $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'"; 1909 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'post_tag' AND tt.term_id IN ($tag_string) )"; 1919 $tax_query[] = array( 1920 'taxonomy' => 'post_tag', 1921 'terms' => $q['tag__not_in'], 1922 'operator' => 'NOT IN', 1923 'field' => 'term_id' 1924 ); 1910 1925 } 1911 1926 1912 // Tag and slug intersections. 1913 $intersections = array('category__and' => 'category', 'tag__and' => 'post_tag', 'tag_slug__and' => 'post_tag', 'tag__in' => 'post_tag', 'tag_slug__in' => 'post_tag'); 1914 $tagin = array('tag__in', 'tag_slug__in'); // These are used to make some exceptions below 1915 foreach ( $intersections as $item => $taxonomy ) { 1916 if ( empty($q[$item]) ) continue; 1917 if ( in_array($item, $tagin) && empty($q['cat']) ) continue; // We should already have what we need if categories aren't being used 1927 if ( !empty( $tax_query ) ) { 1928 $this->tax_query = $tax_query; 1918 1929 1919 if ( $item != 'category__and' ) { 1920 $reqtag = term_exists( $q[$item][0], 'post_tag' ); 1921 if ( !empty($reqtag) ) 1922 $q['tag_id'] = $reqtag['term_id']; 1923 } 1924 1925 if ( in_array( $item, array('tag_slug__and', 'tag_slug__in' ) ) ) 1926 $taxonomy_field = 'slug'; 1927 else 1928 $taxonomy_field = 'term_id'; 1929 1930 $q[$item] = array_unique($q[$item]); 1931 $tsql = "SELECT p.ID FROM $wpdb->posts p INNER JOIN $wpdb->term_relationships tr ON (p.ID = tr.object_id) INNER JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) INNER JOIN $wpdb->terms t ON (tt.term_id = t.term_id)"; 1932 $tsql .= " WHERE tt.taxonomy = '$taxonomy' AND t.$taxonomy_field IN ('" . implode("', '", $q[$item]) . "')"; 1933 if ( !in_array($item, $tagin) ) { // This next line is only helpful if we are doing an and relationship 1934 $tsql .= " GROUP BY p.ID HAVING count(p.ID) = " . count($q[$item]); 1935 } 1936 $post_ids = $wpdb->get_col($tsql); 1937 1938 if ( count($post_ids) ) 1939 $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") "; 1940 else { 1941 $whichcat = " AND 0 = 1"; 1942 break; 1943 } 1930 $where .= " AND $wpdb->posts.ID IN( " . implode( ', ', wp_tax_query( $tax_query ) ) . ")"; 1944 1931 } 1945 1932 1946 // Taxonomies 1947 if ( $this->is_tax ) { 1948 if ( '' != $q['taxonomy'] ) { 1949 $taxonomy = $q['taxonomy']; 1950 $tt[$taxonomy] = $q['term']; 1951 } else { 1952 foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { 1953 if ( $t->query_var && '' != $q[$t->query_var] ) { 1954 $tt[$taxonomy] = $q[$t->query_var]; 1955 break; 1956 } 1957 } 1958 } 1959 1960 $terms = get_terms($taxonomy, array('slug' => $tt[$taxonomy], 'hide_empty' => !is_taxonomy_hierarchical($taxonomy))); 1961 1962 if ( is_wp_error($terms) || empty($terms) ) { 1963 $whichcat = " AND 0 "; 1964 } else { 1965 foreach ( $terms as $term ) { 1966 $term_ids[] = $term->term_id; 1967 if ( is_taxonomy_hierarchical($taxonomy) ) { 1968 $children = get_term_children($term->term_id, $taxonomy); 1969 $term_ids = array_merge($term_ids, $children); 1970 } 1971 } 1972 $post_ids = get_objects_in_term($term_ids, $taxonomy); 1973 if ( !is_wp_error($post_ids) && !empty($post_ids) ) { 1974 $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") "; 1975 if ( empty($post_type) ) { 1976 $post_type = 'any'; 1977 $post_status_join = true; 1978 } elseif ( in_array('attachment', (array)$post_type) ) { 1979 $post_status_join = true; 1980 } 1981 } else { 1982 $whichcat = " AND 0 "; 1983 } 1984 } 1933 if ( !empty($q['meta_key']) ) { 1934 $groupby = "{$wpdb->posts}.ID"; 1985 1935 } 1986 1936 1987 1937 // Author/user stuff … … 2033 1983 $whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $table_alias); 2034 1984 } 2035 1985 2036 $where .= $search . $which cat . $whichauthor . $whichmimetype;1986 $where .= $search . $whichauthor . $whichmimetype; 2037 1987 2038 1988 if ( empty($q['order']) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC')) ) 2039 1989 $q['order'] = 'DESC'; … … 2625 2575 $this->queried_object = NULL; 2626 2576 $this->queried_object_id = 0; 2627 2577 2628 if ( $this->is_category ) { 2629 $cat = $this->get('cat'); 2630 $category = &get_category($cat); 2631 if ( is_wp_error( $category ) ) 2632 return NULL; 2633 $this->queried_object = &$category; 2634 $this->queried_object_id = (int) $cat; 2635 } elseif ( $this->is_tag ) { 2636 $tag_id = $this->get('tag_id'); 2637 $tag = &get_term($tag_id, 'post_tag'); 2638 if ( is_wp_error( $tag ) ) 2639 return NULL; 2640 $this->queried_object = &$tag; 2641 $this->queried_object_id = (int) $tag_id; 2642 } elseif ( $this->is_tax ) { 2643 $tax = $this->get('taxonomy'); 2644 $slug = $this->get('term'); 2645 $term = &get_terms($tax, array( 'slug' => $slug, 'hide_empty' => false ) ); 2646 if ( is_wp_error($term) || empty($term) ) 2647 return NULL; 2648 $term = $term[0]; 2578 if ( $this->tax_query ) { 2579 $query = reset( $this->tax_query ); 2580 if ( 'term_id' == $query['field'] ) 2581 $term = get_term( reset( $query['terms'] ), $query['taxonomy'] ); 2582 else 2583 $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] ); 2584 2649 2585 $this->queried_object = $term; 2650 2586 $this->queried_object_id = $term->term_id; 2651 2587 } elseif ( $this->is_posts_page ) { -
wp-includes/general-template.php
1589 1589 * @param array $args Optional arguments. 1590 1590 */ 1591 1591 function feed_links_extra( $args = array() ) { 1592 global $wp_query; 1593 1592 1594 $defaults = array( 1593 1595 /* translators: Separator between blog name and feed type in feed links */ 1594 1596 'separator' => _x('»', 'feed link'), … … 1614 1616 $href = get_post_comments_feed_link( $post->ID ); 1615 1617 } 1616 1618 } elseif ( is_category() ) { 1617 $ cat_id = intval( get_query_var('cat'));1619 $term = $wp_query->get_queried_object(); 1618 1620 1619 $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name( $cat_id )));1620 $href = get_category_feed_link( $ cat_id );1621 $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name )); 1622 $href = get_category_feed_link( $term->term_id ); 1621 1623 } elseif ( is_tag() ) { 1622 $tag_id = intval( get_query_var('tag_id') ); 1623 $tag = get_tag( $tag_id ); 1624 $term = $wp_query->get_queried_object(); 1624 1625 1625 $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $t ag->name ));1626 $href = get_tag_feed_link( $t ag_id );1626 $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name )); 1627 $href = get_tag_feed_link( $term->term_id ); 1627 1628 } elseif ( is_author() ) { 1628 1629 $author_id = intval( get_query_var('author') ); 1629 1630