diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index dde12c16168be..37e8684bf0d8e 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -1092,7 +1092,7 @@ function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) { } $args = array( - 'taxonomy' => $taxonomy, + 'taxonomy' => $tax->name, 'tag_ID' => $term_id, ); diff --git a/tests/phpunit/tests/link/getEditTermLink.php b/tests/phpunit/tests/link/getEditTermLink.php index d0303f1b1a403..e86cd78449f3d 100644 --- a/tests/phpunit/tests/link/getEditTermLink.php +++ b/tests/phpunit/tests/link/getEditTermLink.php @@ -236,4 +236,17 @@ public function data_get_edit_term_link() { ), ); } + + /** + * Checks that `get_edit_term_link()` produces the correct URL when called without taxonomy. + * + * @ticket 61726 + */ + public function test_get_edit_term_link_without_taxonomy() { + $term = $this->get_term( 'wptests_tax', true ); + + $actual = get_edit_term_link( $term ); + $expected = sprintf( admin_url( 'term.php?taxonomy=wptests_tax&tag_ID=%d&post_type=post' ), $term ); + $this->assertSame( $expected, $actual ); + } }