wpseek.com
A WordPress-centric search engine for devs and theme authors
edit_post_link › WordPress Function
Since1.0.0
Deprecatedn/a
› edit_post_link ( $text = null, $before = '', $after = '', $post = 0, $css_class = 'post-edit-link' )
Parameters: (5) |
|
Defined at: |
|
Codex: | |
Change Log: |
|
Displays the edit post link for post.
Related Functions: get_edit_post_link, next_post_link, next_posts_link, edit_tag_link, edit_term_link
Source
function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $css_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( $css_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;
}