Skip to content

Commit 4acefac

Browse files
committed
Taxonomy: Ensure get_edit_term_link() produces the correct result when called without taxonomy.
This fixes an oversight missed in [36646]. Props debarghyabanerjee. Fixes #61726. See #35922. git-svn-id: https://develop.svn.wordpress.org/trunk@58807 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5351cd2 commit 4acefac

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/wp-includes/link-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) {
10921092
}
10931093

10941094
$args = array(
1095-
'taxonomy' => $taxonomy,
1095+
'taxonomy' => $tax->name,
10961096
'tag_ID' => $term_id,
10971097
);
10981098

tests/phpunit/tests/link/getEditTermLink.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,17 @@ public function data_get_edit_term_link() {
236236
),
237237
);
238238
}
239+
240+
/**
241+
* Checks that `get_edit_term_link()` produces the correct URL when called without taxonomy.
242+
*
243+
* @ticket 61726
244+
*/
245+
public function test_get_edit_term_link_without_taxonomy() {
246+
$term = $this->get_term( 'wptests_tax', true );
247+
248+
$actual = get_edit_term_link( $term );
249+
$expected = sprintf( admin_url( 'term.php?taxonomy=wptests_tax&tag_ID=%d&post_type=post' ), $term );
250+
$this->assertSame( $expected, $actual );
251+
}
239252
}

0 commit comments

Comments
 (0)