Ticket #50225: 50225.1.diff
File 50225.1.diff, 8.3 KB (added by , 3 years ago) |
---|
-
src/wp-admin/includes/class-wp-terms-list-table.php
404 404 405 405 $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; 406 406 407 $edit_link = get_edit_term_link( $tag ->term_id, $taxonomy, $this->screen->post_type );407 $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ); 408 408 409 409 if ( $edit_link ) { 410 410 $edit_link = add_query_arg( … … 470 470 $edit_link = add_query_arg( 471 471 'wp_http_referer', 472 472 urlencode( wp_unslash( $uri ) ), 473 get_edit_term_link( $tag ->term_id, $taxonomy, $this->screen->post_type )473 get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ) 474 474 ); 475 475 476 476 $actions = array(); -
src/wp-includes/category-template.php
735 735 736 736 foreach ( $tags as $key => $tag ) { 737 737 if ( 'edit' === $args['link'] ) { 738 $link = get_edit_term_link( $tag ->term_id, $tag->taxonomy, $args['post_type'] );738 $link = get_edit_term_link( $tag, $tag->taxonomy, $args['post_type'] ); 739 739 } else { 740 $link = get_term_link( (int) $tag->term_id, $tag->taxonomy );740 $link = get_term_link( $tag, $tag->taxonomy ); 741 741 } 742 742 743 743 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
830 830 * 831 831 * @since 2.5.0 832 832 * 833 * @param int $cat_id Category ID.834 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'.835 * Default is the value of get_default_feed().833 * @param int|WP_Term|object $cat The ID or term object whose feed link will be retrieved. 834 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. 835 * Default is the value of get_default_feed(). 836 836 * @return string Link to the feed for the category specified by $cat_id. 837 837 */ 838 function get_category_feed_link( $cat _id, $feed = '' ) {839 return get_term_feed_link( $cat _id, 'category', $feed );838 function get_category_feed_link( $cat, $feed = '' ) { 839 return get_term_feed_link( $cat, 'category', $feed ); 840 840 } 841 841 842 842 /** … … 847 847 * 848 848 * @since 3.0.0 849 849 * 850 * @param int $term_id Term ID. 851 * @param string $taxonomy Optional. Taxonomy of `$term_id`. Default 'category'. 852 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. 853 * Default is the value of get_default_feed(). 850 * @param int|WP_Term|object $term The ID or term object whose feed link will be retrieved. 851 * @param string $taxonomy Optional. Taxonomy of `$term_id`. 852 * Defaults to 'category' if term ID or non WP_Term object is passed. 853 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. 854 * Default is the value of get_default_feed(). 854 855 * @return string|false Link to the feed for the term specified by $term_id and $taxonomy. 855 856 */ 856 function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { 857 $term_id = (int) $term_id; 857 function get_term_feed_link( $term, $taxonomy = '', $feed = '' ) { 858 if ( ! is_object( $term ) ) { 859 $term = (int) $term; 860 $taxonomy = 'category'; 861 } else if ( ! $term instanceof WP_Term ) { 862 $taxonomy = $term->taxonomy; 863 } 858 864 859 $term = get_term( $term _id, $taxonomy );865 $term = get_term( $term, $taxonomy ); 860 866 861 867 if ( empty( $term ) || is_wp_error( $term ) ) { 862 868 return false; … … 870 876 871 877 if ( ! $permalink_structure ) { 872 878 if ( 'category' === $taxonomy ) { 873 $link = home_url( "?feed=$feed&cat=$term _id" );879 $link = home_url( "?feed=$feed&cat=$term->term_id" ); 874 880 } elseif ( 'post_tag' === $taxonomy ) { 875 881 $link = home_url( "?feed=$feed&tag=$term->slug" ); 876 882 } else { … … 878 884 $link = home_url( "?feed=$feed&$t->query_var=$term->slug" ); 879 885 } 880 886 } else { 881 $link = get_term_link( $term _id, $term->taxonomy );887 $link = get_term_link( $term, $term->taxonomy ); 882 888 if ( get_default_feed() == $feed ) { 883 889 $feed_link = 'feed'; 884 890 } else { … … 929 935 * 930 936 * @since 2.3.0 931 937 * 932 * @param int $tag_id Tag ID.933 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'.934 * Default is the value of get_default_feed().938 * @param int|WP_Term|object $tag The ID or term object whose feed link will be retrieved. 939 * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. 940 * Default is the value of get_default_feed(). 935 941 * @return string The feed permalink for the given tag. 936 942 */ 937 function get_tag_feed_link( $tag _id, $feed = '' ) {938 return get_term_feed_link( $tag _id, 'post_tag', $feed );943 function get_tag_feed_link( $tag, $feed = '' ) { 944 return get_term_feed_link( $tag, 'post_tag', $feed ); 939 945 } 940 946 941 947 /** … … 943 949 * 944 950 * @since 2.7.0 945 951 * 946 * @param int $tag_id Tag ID.947 * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'.952 * @param int|WP_Term|object $tag The ID or term object whose edit link will be retrieved. 953 * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'. 948 954 * @return string The edit tag link URL for the given tag. 949 955 */ 950 function get_edit_tag_link( $tag _id, $taxonomy = 'post_tag' ) {956 function get_edit_tag_link( $tag, $taxonomy = 'post_tag' ) { 951 957 /** 952 958 * Filters the edit link for a tag (or term in another taxonomy). 953 959 * … … 955 961 * 956 962 * @param string $link The term edit link. 957 963 */ 958 return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag _id, $taxonomy ) );964 return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag, $taxonomy ) ); 959 965 } 960 966 961 967 /** … … 988 994 * @since 3.1.0 989 995 * @since 4.5.0 The `$taxonomy` parameter was made optional. 990 996 * 991 * @param int $term_id Term ID.992 * @param string $taxonomy Optional. Taxonomy. Defaults to the taxonomy of the term identified993 * by `$term_id`.994 * @param string $object_type Optional. The object type. Used to highlight the proper post type995 * menu on the linked page. Defaults to the first object_type associated996 * with the taxonomy.997 * @param int|WP_Term|object $term The ID or term object whose edit link will be retrieved. 998 * @param string $taxonomy Optional. Taxonomy. Defaults to the taxonomy of the term identified 999 * by `$term`. 1000 * @param string $object_type Optional. The object type. Used to highlight the proper post type 1001 * menu on the linked page. Defaults to the first object_type associated 1002 * with the taxonomy. 997 1003 * @return string|null The edit term link URL for the given term, or null on failure. 998 1004 */ 999 function get_edit_term_link( $term _id, $taxonomy = '', $object_type = '' ) {1000 $term = get_term( $term _id, $taxonomy );1005 function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) { 1006 $term = get_term( $term, $taxonomy ); 1001 1007 if ( ! $term || is_wp_error( $term ) ) { 1002 1008 return; 1003 1009 } … … 1034 1040 * @param string $taxonomy Taxonomy name. 1035 1041 * @param string $object_type The object type (eg. the post type). 1036 1042 */ 1037 return apply_filters( 'get_edit_term_link', $location, $term _id, $taxonomy, $object_type );1043 return apply_filters( 'get_edit_term_link', $location, $term, $taxonomy, $object_type ); 1038 1044 } 1039 1045 1040 1046 /**