edit_tag_link()
Outputs a link to edit the current meta-field if the user is allowed to modify tags.
Must be used on a page type: is_tag().
Uses: edit_term_link()
Hooks from the function
Returns
null. Outputs the HTML code for the link.
Usage
<?php edit_tag_link( $link, $before, $after, $tag ); ?>
- $link(string)
- Text of the link.
Default: __('Edit This') - $before(string)
- Text before the link.
Default: '' - $after(string)
- Text after the link.
Default: '' - $tag(WP_Term/int)
- ID of the tag for which to get the edit link.
Default: null (queried_object)
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 7.0
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;
}