+ /**
+ * Filter the post type archive feed link.
+ *
+ * @since 3.1.0
+ *
+ * @param string $link The post type archive feed link.
+ * @param string $feed Feed type.
+ */
+ return apply_filters( 'post_type_archive_feed_link', $link, $feed );
+}
+
+/**
+ * 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.
+ *
+ * @since 2.3.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param string $context Optional, defaults to display. How to write the '&', defaults to '&'.
+ * @return string The edit post link for the given post.
+ */
+function get_edit_post_link( $id = 0, $context = 'display' ) {
+ if ( ! $post = get_post( $id ) )
+ 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;
+
+ /**
+ * Filter 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', admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) ), $post->ID, $context );
+}
+
+/**
+ * Display edit post link for post.
+ *
+ * @since 1.0.0
+ *
+ * @param string $text Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ * @param int $id Optional. Post ID.
+ */
+function edit_post_link( $text = null, $before = '', $after = '', $id = 0 ) {
+ if ( ! $post = get_post( $id ) ) {
+ return;
+ }
+
+ if ( ! $url = get_edit_post_link( $post->ID ) ) {
+ return;
+ }
+
+ if ( null === $text ) {
+ $text = __( 'Edit This' );
+ }
+
+ $link = '<a class="post-edit-link" href="' . $url . '">' . $text . '</a>';
+
+ /**
+ * Filter 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;
+}
+
+/**
+ * Retrieve delete posts link for post.
+ *
+ * Can be used within the WordPress loop or outside of it, with any post type.
+ *
+ * @since 2.9.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param string $deprecated Not used.
+ * @param bool $force_delete Whether to bypass trash and force deletion. Default is false.
+ * @return string The delete post link URL for the given post.
+ */
+function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
+ if ( ! empty( $deprecated ) )
+ _deprecated_argument( __FUNCTION__, '3.0' );
+
+ if ( !$post = get_post( $id ) )
+ return;
+
+ $post_type_object = get_post_type_object( $post->post_type );
+ if ( !$post_type_object )
+ return;
+
+ if ( !current_user_can( 'delete_post', $post->ID ) )
+ return;
+
+ $action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
+
+ $delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );
+
+ /**
+ * Filter the post delete link.
+ *
+ * @since 2.9.0
+ *
+ * @param string $link The delete link.
+ * @param int $post_id Post ID.
+ * @param bool $force_delete Whether to bypass the trash and force deletion. Default false.
+ */
+ return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete );
+}
+
+/**
+ * Retrieve edit comment link.
+ *
+ * @since 2.3.0
+ *
+ * @param int $comment_id Optional. Comment ID.
+ * @return string The edit comment link URL for the given comment.
+ */
+function get_edit_comment_link( $comment_id = 0 ) {
+ $comment = get_comment( $comment_id );
+
+ if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
+ return;
+
+ $location = admin_url('comment.php?action=editcomment&c=') . $comment->comment_ID;
+
+ /**
+ * Filter the comment edit link.
+ *
+ * @since 2.3.0
+ *
+ * @param string $location The edit link.
+ */
+ return apply_filters( 'get_edit_comment_link', $location );
+}
+
+/**
+ * Display edit comment link with formatting.
+ *
+ * @since 1.0.0
+ *
+ * @param string $text Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ */
+function edit_comment_link( $text = null, $before = '', $after = '' ) {
+ global $comment;
+
+ if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
+ return;
+ }
+
+ if ( null === $text ) {
+ $text = __( 'Edit This' );
+ }
+
+ $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">' . $text . '</a>';
+
+ /**
+ * Filter the comment edit link anchor tag.
+ *
+ * @since 2.3.0
+ *
+ * @param string $link Anchor tag for the edit link.
+ * @param int $comment_id Comment ID.
+ * @param string $text Anchor text.
+ */
+ echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;
+}
+
+/**
+ * Display edit bookmark (literally a URL external to blog) link.
+ *
+ * @since 2.7.0
+ *
+ * @param int $link Optional. Bookmark ID.
+ * @return string The edit bookmark link URL.
+ */
+function get_edit_bookmark_link( $link = 0 ) {
+ $link = get_bookmark( $link );
+
+ if ( !current_user_can('manage_links') )
+ return;
+
+ $location = admin_url('link.php?action=edit&link_id=') . $link->link_id;
+
+ /**
+ * Filter the bookmark (link) edit link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $location The edit link.
+ * @param int $link_id Bookmark ID.
+ */
+ return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id );
+}
+
+/**
+ * Display edit bookmark (literally a URL external to blog) link anchor content.
+ *
+ * @since 2.7.0
+ *
+ * @param string $link Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ * @param int $bookmark Optional. Bookmark ID.
+ */
+function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
+ $bookmark = get_bookmark($bookmark);
+
+ if ( !current_user_can('manage_links') )
+ return;
+
+ if ( empty($link) )
+ $link = __('Edit This');
+
+ $link = '<a href="' . get_edit_bookmark_link( $bookmark ) . '">' . $link . '</a>';
+
+ /**
+ * Filter the bookmark edit link anchor tag.
+ *
+ * @since 2.7.0
+ *
+ * @param string $link Anchor tag for the edit link.
+ * @param int $link_id Bookmark ID.
+ */
+ echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
+}
+
+/**
+ * Retrieve edit user link
+ *
+ * @since 3.5.0
+ *
+ * @param int $user_id Optional. User ID. Defaults to the current user.
+ * @return string URL to edit user page or empty string.
+ */
+function get_edit_user_link( $user_id = null ) {
+ if ( ! $user_id )
+ $user_id = get_current_user_id();
+
+ if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) )
+ return '';
+
+ $user = get_userdata( $user_id );
+
+ if ( ! $user )
+ return '';
+
+ if ( get_current_user_id() == $user->ID )
+ $link = get_edit_profile_url( $user->ID );
+ else
+ $link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
+
+ /**
+ * Filter the user edit link.
+ *
+ * @since 3.5.0
+ *
+ * @param string $link The edit link.
+ * @param int $user_id User ID.
+ */
+ return apply_filters( 'get_edit_user_link', $link, $user->ID );