wpseek.com
A WordPress-centric search engine for devs and theme authors
get_edit_post_link › WordPress Function
Since2.3.0
Deprecatedn/a
› get_edit_post_link ( $post = 0, $context = 'display' )
Parameters: (2) |
|
Returns: |
|
Defined at: |
|
Codex: |
Retrieves the edit post link for post.
Can be used within the WordPress loop or outside of it. Can be used with pages, posts, attachments, and revisions.Related Functions: get_next_post_link, edit_post_link, get_edit_tag_link, get_next_posts_link, get_delete_post_link
Source
function get_edit_post_link( $post = 0, $context = 'display' ) { $post = get_post( $post ); if ( ! $post ) { return; } if ( 'revision' === $post->post_type ) { $action = ''; } elseif ( '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( 'edit_post', $post->ID ) ) { return; } if ( $post_type_object->_edit_link ) { $link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) ); } else { $link = ''; } /** * Filters the post edit link. * * @since 2.3.0 * * @param string $link The edit link. * @param int $post_id Post ID. * @param string $context The link context. If set to 'display' then ampersands * are encoded. */ return apply_filters( 'get_edit_post_link', $link, $post->ID, $context ); }