add_pages_page

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

Add sub menu page to the pages 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_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {

	return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function );

}

273

add_option_whitelist

Definition:
function add_option_whitelist( $new_options, $options = '' ) {}

Parameters

  • unknown_type $new_options
  • unknown_type $options

Source code

function add_option_whitelist( $new_options, $options = '' ) {

	if ( $options == '' )

		global $whitelist_options;

	else

		$whitelist_options = $options;



	foreach ( $new_options as $page => $keys ) {

		foreach ( $keys as $key ) {

			if ( !isset($whitelist_options[ $page ]) || !is_array($whitelist_options[ $page ]) ) {

				$whitelist_options[ $page ] = array();

				$whitelist_options[ $page ][] = $key;

			} else {

				$pos = array_search( $key, $whitelist_options[ $page ] );

				if ( $pos === false )

					$whitelist_options[ $page ][] = $key;

			}

		}

	}



	return $whitelist_options;

}

271

add_options_page

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

Add sub menu page to the options 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_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {

	return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function );

}

267

add_option

Definition:
function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {}

Add a new option.
You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is inserted into the database. Remember, resources can not be serialized or added as an option.

Parameters

  • string $option: Name of option to add. Expected to not be SQL-escaped.
  • mixed $value: Optional. Option value, can be anything. Expected to not be SQL-escaped.
  • mixed $deprecated: Optional. Description. Not used anymore.
  • bool $autoload: Optional. Default is enabled. Whether to load the option when WordPress starts up.

Return values

returns:False if option was not added and true if option was added.

Defined actions

  • add_option
    do_action( 'add_option', $option, $_value );
  • add_option_{$option}
    do_action( "add_option_{$option}", $option, $_value );
  • added_option
    do_action( 'added_option', $option, $_value );

Source code

function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {

	global $wpdb;



	if ( !empty( $deprecated ) )

		_deprecated_argument( __FUNCTION__, '2.3' );



	$option = trim($option);

	if ( empty($option) )

		return false;



	wp_protect_special_option( $option );



	if ( is_object($value) )

		$value = clone $value;



	$value = sanitize_option( $option, $value );



	// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query

	$notoptions = wp_cache_get( 'notoptions', 'options' );

	if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )

		if ( false !== get_option( $option ) )

			return false;



	$_value = $value;

	$value = maybe_serialize( $value );

	$autoload = ( 'no' === $autoload ) ? 'no' : 'yes';

	do_action( 'add_option', $option, $_value );

	if ( ! defined( 'WP_INSTALLING' ) ) {

		if ( 'yes' == $autoload ) {

			$alloptions = wp_load_alloptions();

			$alloptions[$option] = $value;

			wp_cache_set( 'alloptions', $alloptions, 'options' );

		} else {

			wp_cache_set( $option, $value, 'options' );

		}

	}



	// This option exists now

	$notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh

	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {

		unset( $notoptions[$option] );

		wp_cache_set( 'notoptions', $notoptions, 'options' );

	}



	$result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $value, $autoload ) );



	if ( $result ) {

		do_action( "add_option_{$option}", $option, $_value );

		do_action( 'added_option', $option, $_value );

		return true;

	}

265

add_new_user_to_blog

Definition:
function add_new_user_to_blog( $user_id, $email, $meta ) {}

Add a newly created user to the appropriate blog

Parameters

  • int $user_id
  • string $email
  • array $meta

Source code

function add_new_user_to_blog( $user_id, $email, $meta ) {

	global $current_site;

	if ( !empty( $meta[ 'add_to_blog' ] ) ) {

		$blog_id = $meta[ 'add_to_blog' ];

		$role = $meta[ 'new_role' ];

		remove_user_from_blog($user_id, $current_site->blog_id); // remove user from main blog.

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

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

	}

}

261