get_edit_post_link

Definition:
function get_edit_post_link( $id = 0, $context = 'display' ) {}

Retrieve edit posts link for post.
Can be used within the WordPress loop or outside of it. Can be used with pages, posts, attachments, and revisions.

Parameters

  • int $id: Optional. Post ID.
  • string $context: Optional, defaults to display. How to write the ‘&’, defaults to ‘&’.

Defined filters

  • get_edit_post_link
    apply_filters( 'get_edit_post_link', admin_url( sprintf($post_type_object->_edit_link . $action, $post->ID)

Source code

function get_edit_post_link( $id = 0, $context = 'display' ) {

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

		return;



	if ( 'display' == $context )

		$action = '&action=edit';

	else

		$action = '&action=edit';



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

	if ( !$post_type_object )

		return;



	if ( !current_user_can( $post_type_object->cap->edit_post, $post->ID ) )

		return;



	return apply_filters( 'get_edit_post_link', admin_url( sprintf($post_type_object->_edit_link . $action, $post->ID) ), $post->ID, $context );

}

1380

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: