get_user_option_{$option} WordPress Filter Hook

The get_user_option_{$option} hook is an important tool for customizing the way your WordPress site behaves for each individual user. By using this hook, you can change how an option is retrieved for a specific user, or even create a new option altogether. This hook is especially useful for creating custom user settings, or for overriding the default behavior of WordPress options. For example, if you want to give each user the ability to choose their own theme, you could use this hook to add a new setting to the WordPress "Settings" page.

apply_filters( "get_user_option_{$option}", mixed $result, string $option, WP_User $user ) #

Filters a specific user option value.


Description

The dynamic portion of the hook name, $option, refers to the user option name.


Top ↑

Parameters

$result

(mixed)Value for the user's option.

$option

(string)Name of the option being retrieved.

$user

(WP_User)WP_User object of the user whose option is being retrieved.


Top ↑

Source

File: wp-includes/user.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More