update_page_cache

Definition:
function update_page_cache(&$pages) {}

Alias of update_post_cache().

Parameters

  • array $pages: list of page objects
  • &$pages

Source code

function update_page_cache(&$pages) {

	update_post_cache($pages);

}

3189

update_option_new_admin_email

Definition:
function update_option_new_admin_email( $old_value, $value ) {}

Parameters

  • $old_value
  • $value

Defined filters

  • new_admin_email_content
    apply_filters( 'new_admin_email_content', __( "Dear user,

    You recently requested to have the administration email address on

    your site changed.

    If this is correct, please click on the following link to change it:

    ###ADMIN_URL###

    You can safely ignore and delete this email if you do not want to

    take this action.

    This email has been sent to ###EMAIL###

    Regards,

    All at ###SITENAME###

    ###SITEURL### ")

Source code

function update_option_new_admin_email( $old_value, $value ) {

	$email = get_option( 'admin_email' );

	if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )

		return;



	$hash = md5( $value. time() .mt_rand() );

	$new_admin_email = array(

		'hash' => $hash,

		'newemail' => $value

	);

	update_option( 'adminhash', $new_admin_email );



	$content = apply_filters( 'new_admin_email_content', __( "Dear user,



You recently requested to have the administration email address on

your site changed.

If this is correct, please click on the following link to change it:

###ADMIN_URL###



You can safely ignore and delete this email if you do not want to

take this action.



This email has been sent to ###EMAIL###



Regards,

All at ###SITENAME###

###SITEURL### "), $new_admin_email );



	$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );

	$content = str_replace( '###EMAIL###', $value, $content );

	$content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );

	$content = str_replace( '###SITEURL###', network_home_url(), $content );



	wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), get_option( 'blogname' ) ), $content );

}

3187

update_option

Definition:
function update_option( $option, $newvalue ) {}

Update the value of an option that was already added.
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: Option name. Expected to not be SQL-escaped.
  • mixed $newvalue: Option value. Expected to not be SQL-escaped.

Return values

returns:False if value was not updated and true if value was updated.

Defined filters

  • pre_update_option_$option
    apply_filters( 'pre_update_option_' . $option, $newvalue, $oldvalue )

Defined actions

  • update_option
    do_action( 'update_option', $option, $oldvalue, $_newvalue );
  • update_option_{$option}
    do_action( "update_option_{$option}", $oldvalue, $_newvalue );
  • updated_option
    do_action( 'updated_option', $option, $oldvalue, $_newvalue );

Source code

function update_option( $option, $newvalue ) {

	global $wpdb;



	$option = trim($option);

	if ( empty($option) )

		return false;



	wp_protect_special_option( $option );



	if ( is_object($newvalue) )

		$newvalue = clone $newvalue;



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

	$oldvalue = get_option( $option );

	$newvalue = apply_filters( 'pre_update_option_' . $option, $newvalue, $oldvalue );



	// If the new and old values are the same, no need to update.

	if ( $newvalue === $oldvalue )

		return false;



	if ( false === $oldvalue )

		return add_option( $option, $newvalue );



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

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

		unset( $notoptions[$option] );

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

	}



	$_newvalue = $newvalue;

	$newvalue = maybe_serialize( $newvalue );



	do_action( 'update_option', $option, $oldvalue, $_newvalue );

	if ( ! defined( 'WP_INSTALLING' ) ) {

		$alloptions = wp_load_alloptions();

		if ( isset( $alloptions[$option] ) ) {

			$alloptions[$option] = $_newvalue;

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

		} else {

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

		}

	}



	$result = $wpdb->update( $wpdb->options, array( 'option_value' => $newvalue ), array( 'option_name' => $option ) );



	if ( $result ) {

		do_action( "update_option_{$option}", $oldvalue, $_newvalue );

		do_action( 'updated_option', $option, $oldvalue, $_newvalue );

		return true;

	}

3185

update_object_term_cache

Definition:
function update_object_term_cache($object_ids, $object_type) {}

Updates the cache for Term ID(s).
Will only update the cache for terms not already cached.

Parameters

  • string|array $object_ids: Single or list of term object ID(s)
  • array|string $object_type: The taxonomy object type

Return values

returns:Null value is given with empty $object_ids. False if

Source code

function update_object_term_cache($object_ids, $object_type) {

	if ( empty($object_ids) )

		return;



	if ( !is_array($object_ids) )

		$object_ids = explode(',', $object_ids);



	$object_ids = array_map('intval', $object_ids);



	$taxonomies = get_object_taxonomies($object_type);



	$ids = array();

	foreach ( (array) $object_ids as $id ) {

		foreach ( $taxonomies as $taxonomy ) {

			if ( false === wp_cache_get($id, "{$taxonomy}_relationships") ) {

				$ids[] = $id;

				break;

			}

		}

	}

3183

update_nag

Definition:
function update_nag() {}

Source code

function update_nag() {

	if ( is_multisite() && !current_user_can('update_core') )

		return false;



	global $pagenow;



	if ( 'update-core.php' == $pagenow )

		return;



	$cur = get_preferred_from_update_core();



	if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )

		return false;



	if ( current_user_can('update_core') ) {

		$msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url( 'update-core.php' ) );

	} else {

		$msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );

	}

	echo "<div class='update-nag'>$msg</div>";

}

3181