edit_term_link()
Displays/retrieves edit term link (html tag A), link to edit the specified taxonomy element.
Use get_edit_term_link() to get edit term URL (not A tag).
Uses: get_edit_term_link()
Used By: edit_tag_link()
Hooks from the function
Return
String|null
. <a> HTML tag. null when the user has no cap to edit the term.
Usage
edit_term_link( $link, $before, $after, $term, $display );
- $link(string)
- Anchor text. If empty. Default empty.
Default: 'Edit This' - $before(string)
- Display before edit link.
Default: '' - $after(string)
- Display after edit link.
Default: '' - $term(int|WP_Term|null)
- Term ID or object. If null, the queried object will be inspected.
Default: null - $display(true|false)
- Whether or not to echo the return.
Default: true
Examples
#1 Display link to edit the current term
It is assumed that the link is displayed on a term archive page.
edit_term_link(); // displays: // <a href="http://example.com/wp-admin/edit-tags.php?action=edit&taxonomy=funccat&tag_ID=154&post_type=func">Edit</a>
#2 Output a link to edit the specified term
$term = get_term( 154 ); edit_term_link( 'Edit term', '', '', $term, 0 ); // displays: // <a href="http://example.com/wp-admin/edit-tags.php?action=edit&taxonomy=funccat&tag_ID=154&post_type=func">Edit term</a>
Changelog
Since 3.1.0 | Introduced. |