Advertisements

set_user_setting

Definition:
function set_user_setting( $name, $value ) {}

Add or update user interface setting.
Both $name and $value can contain only ASCII letters, numbers and underscores. This function has to be used before any output has started as it calls setcookie().

Parameters

  • string $name: The name of the setting.
  • string $value: The value for the setting.

Return values

returns:true if set successfully/false if not.

Source code

function set_user_setting( $name, $value ) {



	if ( headers_sent() )

		return false;



	$all = get_all_user_settings();

	$name = preg_replace( '/[^A-Za-z0-9_]+/', '', $name );



	if ( empty($name) )

		return false;



	$all[$name] = $value;



	return wp_set_all_user_settings($all);

}

2859

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: