Skip to content

Commit

Permalink
Taxonomy: Ensure get_edit_term_link() produces the correct result w…
Browse files Browse the repository at this point in the history
…hen 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
  • Loading branch information
felixarntz committed Jul 24, 2024
1 parent 5351cd2 commit 4acefac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/link-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) {
}

$args = array(
'taxonomy' => $taxonomy,
'taxonomy' => $tax->name,
'tag_ID' => $term_id,
);

Expand Down
13 changes: 13 additions & 0 deletions tests/phpunit/tests/link/getEditTermLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}

0 comments on commit 4acefac

Please sign in to comment.