edit_post_link() – Displays the edit post link for post.
You appear to be a bot. Output may be restricted
Description
Displays the edit post link for post.
Usage
edit_post_link( $text, $before, $after, $post, $class );
Parameters
- $text
- ( string ) optional – Optional. Anchor text. If null, default is 'Edit This'. Default null.
- $before
- ( string ) optional – Optional. Display before edit link. Default empty.
- $after
- ( string ) optional – Optional. Display after edit link. Default empty.
- $post
- ( int|WP_Post ) optional – Optional. Post ID or post object. Default is the global `$post`.
- $class
- ( string ) optional default: post-edit-link – Optional. Add custom class to link. Default 'post-edit-link'.
Returns
void
Source
File name: wordpress/wp-includes/link-template.php
Lines:
1 to 32 of 32
function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $class = 'post-edit-link' ) { $post = get_post( $post ); if ( ! $post ) { return; } $url = get_edit_post_link( $post->ID ); if ( ! $url ) { return; } if ( null === $text ) { $text = __( 'Edit This' ); } $link = '<a class="' . esc_attr( $class ) . '" href="' . esc_url( $url ) . '">' . $text . '</a>'; /** * Filters the post edit link anchor tag. * * @since 2.3.0 * * @param string $link Anchor tag for the edit link. * @param int $post_id Post ID. * @param string $text Anchor text. */ echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after; }