Advertisements

edit_post_link

Definition:
function edit_post_link( $link = null, $before = '', $after = '', $id = 0 ) {}

Display edit post link for post.

Parameters

  • string $link: Optional. Anchor text.
  • string $before: Optional. Display before edit link.
  • string $after: Optional. Display after edit link.
  • int $id: Optional. Post ID.

Defined filters

  • edit_post_link
    apply_filters( 'edit_post_link', $link, $post->ID )

Source code

function edit_post_link( $link = null, $before = '', $after = '', $id = 0 ) {

	if ( !$post = &get_post( $id ) )

		return;



	if ( !$url = get_edit_post_link( $post->ID ) )

		return;



	if ( null === $link )

		$link = __('Edit This');



	$post_type_obj = get_post_type_object( $post->post_type );

	$link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>';

	echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;

}

1004

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: