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

get_edit_comment_link

Definition:
function get_edit_comment_link( $comment_id = 0 ) {}

Retrieve edit comment link.

Parameters

  • int $comment_id: Optional. Comment ID.

Defined filters

  • get_edit_comment_link
    apply_filters( 'get_edit_comment_link', $location )

Source code

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;

	return apply_filters( 'get_edit_comment_link', $location );

}

1378

get_edit_bookmark_link

Definition:
function get_edit_bookmark_link( $link = 0 ) {}

Display edit bookmark (literally a URL external to blog) link.

Parameters

  • int $link: Optional. Bookmark ID.

Defined filters

  • get_edit_bookmark_link
    apply_filters( 'get_edit_bookmark_link', $location, $link->link_id )

Source code

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;

	return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id );

}

1376

get_editable_user_ids

Definition:
function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {}

Parameters

  • int $user_id: User ID.
  • bool $exclude_zeros: Optional, default is true. Whether to exclude zeros.
  • $post_type

Source code

function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {

	global $wpdb;



	$user = new WP_User( $user_id );

	$post_type_obj = get_post_type_object($post_type);



	if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {

		if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )

			return array($user->id);

		else

			return array();

	}



	if ( !is_multisite() )

		$level_key = $wpdb->get_blog_prefix() . 'user_level';

	else

		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels



	$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);

	if ( $exclude_zeros )

		$query .= " AND meta_value != '0'";



	return $wpdb->get_col( $query );

}

1374

get_editable_roles

Definition:
function get_editable_roles() {}

Fetch a filtered list of user roles that the current user is allowed to edit.
Simple function who’s main purpose is to allow filtering of the list of roles in the $wp_roles object so that plugins can remove inappropriate ones depending on the situation or user making edits. Specifically because without filtering anyone with the edit_users capability can edit others to be administrators, even if they are only editors or authors. This filter allows admins to delegate user management.

Defined filters

  • editable_roles
    apply_filters('editable_roles', $all_roles)

Source code

function get_editable_roles() {

	global $wp_roles;



	$all_roles = $wp_roles->roles;

	$editable_roles = apply_filters('editable_roles', $all_roles);



	return $editable_roles;

}

1372