edit_tag_link()
Displays or retrieves the edit link for a tag with formatting.
Uses: edit_term_link()
Hooks from the function
Return
null
. Nothing.
Usage
edit_tag_link( $link, $before, $after, $tag );
- $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: '' - $tag(WP_Term)
- Term object. If null, the queried object will be inspected.
Default: null
Examples
#1 Display the link to edit the current tag
<?php edit_tag_link(); ?>
#2 Change the link text
Let's display a link to edit tags, change the link text to "Edit tag" and "stick" that link in the html tag <p>
:
<?php edit_tag_link( 'Edit tag', '<p>', '</p>' ); ?>
Changelog
Since 2.7.0 | Introduced. |
edit_tag_link() edit tag link code WP 6.1.1
function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { $link = edit_term_link( $link, '', '', $tag, false ); /** * Filters the anchor tag for the edit link for a tag (or term in another taxonomy). * * @since 2.7.0 * * @param string $link The anchor tag for the edit link. */ echo $before . apply_filters( 'edit_tag_link', $link ) . $after; }