diff --git a/src/wp-admin/includes/class-wp-terms-list-table.php b/src/wp-admin/includes/class-wp-terms-list-table.php
index 5dd29d5ce1..e26ea4b5d3 100644
|
a
|
b
|
class WP_Terms_List_Table extends WP_List_Table { |
| 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( |
| … |
… |
class WP_Terms_List_Table extends WP_List_Table { |
| 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(); |
diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
index 5af7173a9d..a46d710676 100644
|
a
|
b
|
function wp_tag_cloud( $args = '' ) { |
| 737 | 737 | |
| 738 | 738 | foreach ( $tags as $key => $tag ) { |
| 739 | 739 | if ( 'edit' === $args['link'] ) { |
| 740 | | $link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] ); |
| | 740 | $link = get_edit_term_link( $tag, $tag->taxonomy, $args['post_type'] ); |
| 741 | 741 | } else { |
| 742 | | $link = get_term_link( (int) $tag->term_id, $tag->taxonomy ); |
| | 742 | $link = get_term_link( $tag, $tag->taxonomy ); |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | if ( is_wp_error( $link ) ) { |
diff --git a/src/wp-includes/class-walker-category.php b/src/wp-includes/class-walker-category.php
index 94ebc58db2..a8c9bbb80e 100644
|
a
|
b
|
class Walker_Category extends Walker { |
| 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. */ |
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index 9554de3d2f..b0a43239cb 100644
|
a
|
b
|
function get_feed_link( $feed = '' ) { |
| 690 | 690 | |
| 691 | 691 | $permalink = $wp_rewrite->get_feed_permastruct(); |
| 692 | 692 | |
| 693 | | if ( $permalink ) { |
| | 693 | if ( '' !== $permalink ) { |
| 694 | 694 | if ( false !== strpos( $feed, 'comments_' ) ) { |
| 695 | 695 | $feed = str_replace( 'comments_', '', $feed ); |
| 696 | 696 | $permalink = $wp_rewrite->get_comment_feed_permastruct(); |
| … |
… |
function get_author_feed_link( $author_id, $feed = '' ) { |
| 898 | 898 | * |
| 899 | 899 | * @since 2.5.0 |
| 900 | 900 | * |
| 901 | | * @param int $cat_id Category ID. |
| 902 | | * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. |
| 903 | | * Default is the value of get_default_feed(). |
| | 901 | * @param int|WP_Term|object $cat The ID or term object whose feed link will be retrieved. |
| | 902 | * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. |
| | 903 | * Default is the value of get_default_feed(). |
| 904 | 904 | * @return string Link to the feed for the category specified by $cat_id. |
| 905 | 905 | */ |
| 906 | | function get_category_feed_link( $cat_id, $feed = '' ) { |
| 907 | | return get_term_feed_link( $cat_id, 'category', $feed ); |
| | 906 | function get_category_feed_link( $cat, $feed = '' ) { |
| | 907 | return get_term_feed_link( $cat, 'category', $feed ); |
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | /** |
| … |
… |
function get_category_feed_link( $cat_id, $feed = '' ) { |
| 915 | 915 | * |
| 916 | 916 | * @since 3.0.0 |
| 917 | 917 | * |
| 918 | | * @param int $term_id Term ID. |
| 919 | | * @param string $taxonomy Optional. Taxonomy of `$term_id`. Default 'category'. |
| 920 | | * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. |
| 921 | | * Default is the value of get_default_feed(). |
| | 918 | * @param int|WP_Term|object $term The ID or term object whose feed link will be retrieved. |
| | 919 | * @param string $taxonomy Optional. Taxonomy of `$term_id`. |
| | 920 | * Defaults to 'category' if term ID or non WP_Term object is passed. |
| | 921 | * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. |
| | 922 | * Default is the value of get_default_feed(). |
| 922 | 923 | * @return string|false Link to the feed for the term specified by $term_id and $taxonomy. |
| 923 | 924 | */ |
| 924 | | function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { |
| 925 | | $term_id = (int) $term_id; |
| | 925 | function get_term_feed_link( $term, $taxonomy = '', $feed = '' ) { |
| | 926 | if ( ! is_object( $term ) ) { |
| | 927 | $term = (int) $term; |
| | 928 | $taxonomy = 'category'; |
| | 929 | } elseif ( ! $term instanceof WP_Term ) { |
| | 930 | $taxonomy = $term->taxonomy; |
| | 931 | } |
| 926 | 932 | |
| 927 | | $term = get_term( $term_id, $taxonomy ); |
| | 933 | $term = get_term( $term, $taxonomy ); |
| 928 | 934 | |
| 929 | 935 | if ( empty( $term ) || is_wp_error( $term ) ) { |
| 930 | 936 | return false; |
| … |
… |
function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { |
| 938 | 944 | |
| 939 | 945 | if ( ! $permalink_structure ) { |
| 940 | 946 | if ( 'category' === $taxonomy ) { |
| 941 | | $link = home_url( "?feed=$feed&cat=$term_id" ); |
| | 947 | $link = home_url( "?feed=$feed&cat=$term->term_id" ); |
| 942 | 948 | } elseif ( 'post_tag' === $taxonomy ) { |
| 943 | 949 | $link = home_url( "?feed=$feed&tag=$term->slug" ); |
| 944 | 950 | } else { |
| … |
… |
function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { |
| 946 | 952 | $link = home_url( "?feed=$feed&$t->query_var=$term->slug" ); |
| 947 | 953 | } |
| 948 | 954 | } else { |
| 949 | | $link = get_term_link( $term_id, $term->taxonomy ); |
| | 955 | $link = get_term_link( $term, $term->taxonomy ); |
| 950 | 956 | if ( get_default_feed() == $feed ) { |
| 951 | 957 | $feed_link = 'feed'; |
| 952 | 958 | } else { |
| … |
… |
function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { |
| 997 | 1003 | * |
| 998 | 1004 | * @since 2.3.0 |
| 999 | 1005 | * |
| 1000 | | * @param int $tag_id Tag ID. |
| 1001 | | * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. |
| 1002 | | * Default is the value of get_default_feed(). |
| 1003 | | * @return string The feed permalink for the given tag. |
| | 1006 | * @param int|WP_Term|object $tag The ID or term object whose feed link will be retrieved. |
| | 1007 | * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. |
| | 1008 | * Default is the value of get_default_feed(). |
| | 1009 | * @return string The feed permalink for the given tag. |
| 1004 | 1010 | */ |
| 1005 | | function get_tag_feed_link( $tag_id, $feed = '' ) { |
| 1006 | | return get_term_feed_link( $tag_id, 'post_tag', $feed ); |
| | 1011 | function get_tag_feed_link( $tag, $feed = '' ) { |
| | 1012 | return get_term_feed_link( $tag, 'post_tag', $feed ); |
| 1007 | 1013 | } |
| 1008 | 1014 | |
| 1009 | 1015 | /** |
| … |
… |
function get_tag_feed_link( $tag_id, $feed = '' ) { |
| 1011 | 1017 | * |
| 1012 | 1018 | * @since 2.7.0 |
| 1013 | 1019 | * |
| 1014 | | * @param int $tag_id Tag ID. |
| 1015 | | * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'. |
| | 1020 | * @param int|WP_Term|object $tag The ID or term object whose edit link will be retrieved. |
| | 1021 | * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'. |
| 1016 | 1022 | * @return string The edit tag link URL for the given tag. |
| 1017 | 1023 | */ |
| 1018 | | function get_edit_tag_link( $tag_id, $taxonomy = 'post_tag' ) { |
| | 1024 | function get_edit_tag_link( $tag, $taxonomy = 'post_tag' ) { |
| 1019 | 1025 | /** |
| 1020 | 1026 | * Filters the edit link for a tag (or term in another taxonomy). |
| 1021 | 1027 | * |
| … |
… |
function get_edit_tag_link( $tag_id, $taxonomy = 'post_tag' ) { |
| 1023 | 1029 | * |
| 1024 | 1030 | * @param string $link The term edit link. |
| 1025 | 1031 | */ |
| 1026 | | return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag_id, $taxonomy ) ); |
| | 1032 | return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag, $taxonomy ) ); |
| 1027 | 1033 | } |
| 1028 | 1034 | |
| 1029 | 1035 | /** |
| … |
… |
function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { |
| 1056 | 1062 | * @since 3.1.0 |
| 1057 | 1063 | * @since 4.5.0 The `$taxonomy` parameter was made optional. |
| 1058 | 1064 | * |
| 1059 | | * @param int $term_id Term ID. |
| 1060 | | * @param string $taxonomy Optional. Taxonomy. Defaults to the taxonomy of the term identified |
| 1061 | | * by `$term_id`. |
| 1062 | | * @param string $object_type Optional. The object type. Used to highlight the proper post type |
| 1063 | | * menu on the linked page. Defaults to the first object_type associated |
| 1064 | | * with the taxonomy. |
| | 1065 | * @param int|WP_Term|object $term The ID or term object whose edit link will be retrieved. |
| | 1066 | * @param string $taxonomy Optional. Taxonomy. Defaults to the taxonomy of the term identified |
| | 1067 | * by `$term`. |
| | 1068 | * @param string $object_type Optional. The object type. Used to highlight the proper post type |
| | 1069 | * menu on the linked page. Defaults to the first object_type associated |
| | 1070 | * with the taxonomy. |
| 1065 | 1071 | * @return string|null The edit term link URL for the given term, or null on failure. |
| 1066 | 1072 | */ |
| 1067 | | function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) { |
| 1068 | | $term = get_term( $term_id, $taxonomy ); |
| | 1073 | function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) { |
| | 1074 | $term = get_term( $term, $taxonomy ); |
| 1069 | 1075 | if ( ! $term || is_wp_error( $term ) ) { |
| 1070 | 1076 | return; |
| 1071 | 1077 | } |
| … |
… |
function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) { |
| 1102 | 1108 | * @param string $taxonomy Taxonomy name. |
| 1103 | 1109 | * @param string $object_type The object type (eg. the post type). |
| 1104 | 1110 | */ |
| 1105 | | return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type ); |
| | 1111 | return apply_filters( 'get_edit_term_link', $location, $term, $taxonomy, $object_type ); |
| 1106 | 1112 | } |
| 1107 | 1113 | |
| 1108 | 1114 | /** |