adjacent_posts_rel_link

Definition:
function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {}

Display relational links for the posts adjacent to the current post.

Parameters

  • string $title: Optional. Link title format.
  • bool $in_same_cat: Optional. Whether link should be in a same category.
  • array|string $excluded_categories: Optional. Array or comma-separated list of excluded category IDs.

Source code

function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {

	echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true);

	echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);

}

389

adjacent_image_link

Definition:
function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {}

Display next or previous image link that has the same post parent.
Retrieves the current attachment object from the $post global.

Parameters

  • bool $prev: Optional. Default is true to display previous link, false for next.
  • $size
  • $text

Source code

function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {

	global $post;

	$post = get_post($post);

	$attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));



	foreach ( $attachments as $k => $attachment )

		if ( $attachment->ID == $post->ID )

			break;



	$k = $prev ? $k - 1 : $k + 1;



	if ( isset($attachments[$k]) )

		echo wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text);

}

387

add_utility_page

Definition:
function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {}

Add a top level menu page in the ‘utility’ section
This function takes a capability which will be used to determine whether or not a page is included in the menu.

Parameters

  • string $page_title: The text to be displayed in the title tags of the page when the menu is selected
  • string $menu_title: The text to be used for the menu
  • string $capability: The capability required for this menu to be displayed to the user.
  • string $menu_slug: The slug name to refer to this menu by (should be unique for this menu)
  • callback $function: The function to be called to output the content for this page.
  • string $icon_url: The url to the icon to be used for this menu

Return values

returns:The resulting page’s hook_suffix

Source code

function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {

	global $_wp_last_utility_menu;



	$_wp_last_utility_menu++;



	return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu);

}

385

add_user_to_blog

Definition:
function add_user_to_blog( $blog_id, $user_id, $role ) {}

Add a user to a blog.
Use the ‘add_user_to_blog’ action to fire an event when users are added to a blog.

Parameters

  • int $blog_id: ID of the blog you’re adding the user to.
  • int $user_id: ID of the user you’re adding.
  • string $role: The role you want the user to have

Defined actions

  • add_user_to_blog
    do_action('add_user_to_blog', $user_id, $role, $blog_id);

Source code

function add_user_to_blog( $blog_id, $user_id, $role ) {

	switch_to_blog($blog_id);



	$user = new WP_User($user_id);



	if ( empty( $user->ID ) ) {

		restore_current_blog();

		return new WP_Error('user_does_not_exist', __('That user does not exist.'));

	}



	if ( !get_user_meta($user_id, 'primary_blog', true) ) {

		update_user_meta($user_id, 'primary_blog', $blog_id);

		$details = get_blog_details($blog_id);

		update_user_meta($user_id, 'source_domain', $details->domain);

	}



	$user->set_role($role);



	do_action('add_user_to_blog', $user_id, $role, $blog_id);

	wp_cache_delete( $user_id, 'users' );

	restore_current_blog();

	return true;

}

383

add_user_meta

Definition:
function add_user_meta($user_id, $meta_key, $meta_value, $unique = false) {}

Add meta data field to a user.
Post meta data is called "Custom Fields" on the Administration Screens.

Parameters

  • int $user_id: Post ID.
  • string $meta_key: Metadata name.
  • mixed $meta_value: Metadata value.
  • bool $unique: Optional, default is false. Whether the same key should not be added.

Return values

returns:False for failure. True for success.

Source code

function add_user_meta($user_id, $meta_key, $meta_value, $unique = false) {

	return add_metadata('user', $user_id, $meta_key, $meta_value, $unique);

}

381