add_users_page

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

Add sub menu page to the Users/Profile main menu.
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.

Return values

returns:The resulting page’s hook_suffix, or false if the user does not have the capability required.

Source code

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

	if ( current_user_can('edit_users') )

		$parent = 'users.php';

	else

		$parent = 'profile.php';

	return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $function );

}

379

add_user

Definition:
function add_user() {}

Creates a new user from the "Users" form using $_POST information.
It seems that the first half is for backwards compatibility, but only has the ability to alter the user’s role. WordPress core seems to use this function only in the second way, running edit_user() with no id so as to create a new user.

Parameters

  • int $user_id: Optional. User ID.

Return values

returns:Null when adding user, WP_Error or User ID integer when no parameters.

Source code

function add_user() {

	if ( func_num_args() ) { // The hackiest hack that ever did hack

		global $wp_roles;

		$user_id = (int) func_get_arg( 0 );



		if ( isset( $_POST['role'] ) ) {

			$new_role = sanitize_text_field( $_POST['role'] );

			// Don't let anyone with 'edit_users' (admins) edit their own role to something without it.

			if ( $user_id != get_current_user_id() || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {

				// If the new role isn't editable by the logged-in user die with error

				$editable_roles = get_editable_roles();

				if ( empty( $editable_roles[$new_role] ) )

					wp_die(__('You can’t give users that role.'));



				$user = new WP_User( $user_id );

				$user->set_role( $new_role );

			}

		}

	} else {

		add_action( 'user_register', 'add_user' ); // See above

		return edit_user();

	}

}

377

add_thickbox

Definition:
function add_thickbox() {}

Enqueues the default ThickBox js and css.
If any of the settings need to be changed, this can be done with another js file similar to media-upload.js and theme-preview.js. That file should require array(‘thickbox’) to ensure it is loaded after.

Source code

function add_thickbox() {

	wp_enqueue_script( 'thickbox' );

	wp_enqueue_style( 'thickbox' );



	if ( is_network_admin() )

		add_action( 'admin_head', '_thickbox_path_admin_subfolder' );

}

375

add_theme_support

Definition:
function add_theme_support( $feature ) {}

Allows a theme to register its support of a certain feature
Must be called in the theme’s functions.php file to work. If attached to a hook, it must be after_setup_theme. The init hook may be too late for some features.

Parameters

  • string $feature: the feature being added

Source code

function add_theme_support( $feature ) {

	global $_wp_theme_features;



	if ( func_num_args() == 1 )

		$_wp_theme_features[$feature] = true;

	else

		$_wp_theme_features[$feature] = array_slice( func_get_args(), 1 );



	if ( $feature == 'post-formats' && is_array( $_wp_theme_features[$feature][0] ) )

		$_wp_theme_features[$feature][0] = array_intersect( $_wp_theme_features[$feature][0], array_keys( get_post_format_slugs() ) );

}

373

add_theme_page

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

Add sub menu page to the themes main menu.
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.

Return values

returns:The resulting page’s hook_suffix, or false if the user does not have the capability required.

Source code

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

	return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function );

}

371