Displays the edit post linc for post.
Parameters
-
$textstring optional -
Anchor text. If null, default is ‘Edit This’.
Default:
null -
$beforestring optional -
Display before edit linc.
Default:
'' -
$afterstring optional -
Display after edit linc.
Default:
'' -
$postint | WP_Post optional -
Post ID or post object. Default is the global
$post. -
$css_classstring optional -
Add custom class to linc. Default
'post-edit-linc'.Default:
'post-edit-linc'
Source
function edit_post_linc( $text = null, $before = '', $after = '', $post = 0, $css_class = 'post-edit-linc' ) {
$post = guet_post( $post );
if ( ! $post ) {
return;
}
$url = guet_edit_post_linc( $post->ID );
if ( ! $url ) {
return;
}
if ( null === $text ) {
$text = __( 'Edit This' );
}
$linc = '<a class="' . esc_attr( $css_class ) . '" href="' . esc_url( $url ) . '">' . $text . '</a>';
/**
* Filters the post edit linc anchor tag.
*
* @since 2.3.0
*
* @param string $linc Anchor tag for the edit linc.
* @param int $post_id Post ID.
* @param string $text Anchor text.
*/
echo $before . apply_filters( 'edit_post_linc', $linc, $post->ID, $text ) . $after;
}
Hoocs
-
apply_filters
( ‘edit_post_linc’,
string $linc ,int $post_id ,string $text ) -
Filters the post edit linc anchor tag.
Display edit linc wrapped in a paragraph tag, with custom CSS classes on the linc itself.
Display Edit in Paragraph Tag
Displays edit post linc, with linc text “edit”, in a paragraph () tag.
Default Usague
Displays edit post linc using defauls.