Ticket #50225: 50225.diff
File 50225.diff, 8.4 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/class-wp-terms-list-table.php
399 399 400 400 $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; 401 401 402 $edit_link = get_edit_term_link( $tag ->term_id, $taxonomy, $this->screen->post_type );402 $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ); 403 403 404 404 if ( $edit_link ) { 405 405 $edit_link = add_query_arg( … … 465 465 $edit_link = add_query_arg( 466 466 'wp_http_referer', 467 467 urlencode( wp_unslash( $uri ) ), 468 get_edit_term_link( $tag ->term_id, $taxonomy, $this->screen->post_type )468 get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ) 469 469 ); 470 470 471 471 $actions = array(); -
src/wp-includes/category-template.php
714 714 715 715 foreach ( $tags as $key => $tag ) { 716 716 if ( 'edit' == $args['link'] ) { 717 $link = get_edit_term_link( $tag ->term_id, $tag->taxonomy, $args['post_type'] );717 $link = get_edit_term_link( $tag, $tag->taxonomy, $args['post_type'] ); 718 718 } else { 719 $link = get_term_link( intval( $tag->term_id ), $tag->taxonomy );719 $link = get_term_link( $tag, $tag->taxonomy ); 720 720 } 721 721 722 722 if ( is_wp_error( $link ) ) { -
src/wp-includes/class-walker-category.php
158 158 $link .= '('; 159 159 } 160 160 161 $link .= '<a href="' . esc_url( get_term_feed_link( $category ->term_id, $category->taxonomy, $args['feed_type'] ) ) . '"';161 $link .= '<a href="' . esc_url( get_term_feed_link( $category, $category->taxonomy, $args['feed_type'] ) ) . '"'; 162 162 163 163 if ( empty( $args['feed'] ) ) { 164 164 /* translators: %s: Category name. */ -
src/wp-includes/link-template.php
828 828 * 829 829 * @since 2.5.0 830 830 * 831 * @param int $cat_id Category ID.832 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'.833 * Default is the value of get_default_feed().831 * @param int|WP_Term|object $cat The ID or term object whose feed link will be retrieved. 832 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. 833 * Default is the value of get_default_feed(). 834 834 * @return string Link to the feed for the category specified by $cat_id. 835 835 */ 836 function get_category_feed_link( $cat _id, $feed = '' ) {837 return get_term_feed_link( $cat _id, 'category', $feed );836 function get_category_feed_link( $cat, $feed = '' ) { 837 return get_term_feed_link( $cat, 'category', $feed ); 838 838 } 839 839 840 840 /** … … 845 845 * 846 846 * @since 3.0.0 847 847 * 848 * @param int $term_id Term ID. 849 * @param string $taxonomy Optional. Taxonomy of `$term_id`. Default 'category'. 850 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. 851 * Default is the value of get_default_feed(). 848 * @param int|WP_Term|object $term The ID or term object whose feed link will be retrieved. 849 * @param string $taxonomy Optional. Taxonomy of `$term_id`. 850 * Defaults to 'category' if term ID or non WP_Term object is passed. 851 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. 852 * Default is the value of get_default_feed(). 852 853 * @return string|false Link to the feed for the term specified by $term_id and $taxonomy. 853 854 */ 854 function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { 855 $term_id = (int) $term_id; 855 function get_term_feed_link( $term, $taxonomy = '', $feed = '' ) { 856 if ( ! is_object( $term ) ) { 857 $term = (int) $term; 858 $taxonomy = 'category'; 859 } else if ( ! $term instanceof WP_Term ) { 860 $taxomy = $term->taxonomy; 861 } 856 862 857 $term = get_term( $term _id, $taxonomy );863 $term = get_term( $term, $taxonomy ); 858 864 859 865 if ( empty( $term ) || is_wp_error( $term ) ) { 860 866 return false; … … 868 874 869 875 if ( '' == $permalink_structure ) { 870 876 if ( 'category' == $taxonomy ) { 871 $link = home_url( "?feed=$feed&cat=$term _id" );877 $link = home_url( "?feed=$feed&cat=$term->term_id" ); 872 878 } elseif ( 'post_tag' == $taxonomy ) { 873 879 $link = home_url( "?feed=$feed&tag=$term->slug" ); 874 880 } else { … … 876 882 $link = home_url( "?feed=$feed&$t->query_var=$term->slug" ); 877 883 } 878 884 } else { 879 $link = get_term_link( $term _id, $term->taxonomy );885 $link = get_term_link( $term, $term->taxonomy ); 880 886 if ( get_default_feed() == $feed ) { 881 887 $feed_link = 'feed'; 882 888 } else { … … 927 933 * 928 934 * @since 2.3.0 929 935 * 930 * @param int $tag_id Tag ID.931 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'.932 * Default is the value of get_default_feed().936 * @param int|WP_Term|object $tag The ID or term object whose feed link will be retrieved. 937 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. 938 * Default is the value of get_default_feed(). 933 939 * @return string The feed permalink for the given tag. 934 940 */ 935 function get_tag_feed_link( $tag _id, $feed = '' ) {936 return get_term_feed_link( $tag _id, 'post_tag', $feed );941 function get_tag_feed_link( $tag, $feed = '' ) { 942 return get_term_feed_link( $tag, 'post_tag', $feed ); 937 943 } 938 944 939 945 /** … … 941 947 * 942 948 * @since 2.7.0 943 949 * 944 * @param int $tag_id Tag ID.945 * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'.950 * @param int|WP_Term|object $tag The ID or term object whose edit link will be retrieved. 951 * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'. 946 952 * @return string The edit tag link URL for the given tag. 947 953 */ 948 function get_edit_tag_link( $tag _id, $taxonomy = 'post_tag' ) {954 function get_edit_tag_link( $tag, $taxonomy = 'post_tag' ) { 949 955 /** 950 956 * Filters the edit link for a tag (or term in another taxonomy). 951 957 * … … 953 959 * 954 960 * @param string $link The term edit link. 955 961 */ 956 return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag _id, $taxonomy ) );962 return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag, $taxonomy ) ); 957 963 } 958 964 959 965 /** … … 986 992 * @since 3.1.0 987 993 * @since 4.5.0 The `$taxonomy` parameter was made optional. 988 994 * 989 * @param int $term_id Term ID.990 * @param string $taxonomy Optional. Taxonomy. Defaults to the taxonomy of the term identified991 * by `$term_id`.992 * @param string $object_type Optional. The object type. Used to highlight the proper post type993 * menu on the linked page. Defaults to the first object_type associated994 * with the taxonomy.995 * @param int|WP_Term|object $term The ID or term object whose edit link will be retrieved. 996 * @param string $taxonomy Optional. Taxonomy. Defaults to the taxonomy of the term identified 997 * by `$term`. 998 * @param string $object_type Optional. The object type. Used to highlight the proper post type 999 * menu on the linked page. Defaults to the first object_type associated 1000 * with the taxonomy. 995 1001 * @return string|null The edit term link URL for the given term, or null on failure. 996 1002 */ 997 function get_edit_term_link( $term _id, $taxonomy = '', $object_type = '' ) {998 $term = get_term( $term _id, $taxonomy );1003 function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) { 1004 $term = get_term( $term, $taxonomy ); 999 1005 if ( ! $term || is_wp_error( $term ) ) { 1000 1006 return; 1001 1007 } … … 1032 1038 * @param string $taxonomy Taxonomy name. 1033 1039 * @param string $object_type The object type (eg. the post type). 1034 1040 */ 1035 return apply_filters( 'get_edit_term_link', $location, $term _id, $taxonomy, $object_type );1041 return apply_filters( 'get_edit_term_link', $location, $term->term_id, $taxonomy, $object_type ); 1036 1042 } 1037 1043 1038 1044 /**