The get_settings() WordPress PHP function retrieves the value of a specific option or setting.
Usage
To use the function, simply call get_settings('option_name')
. Here’s a custom example:
$site_title = get_settings('blogname'); echo "The site title is: " . $site_title;
Parameters
$option
(string) – Required. The name of the option or setting you want to retrieve.
More information
See WordPress Developer Resources: get_settings()
Important: The get_settings()
function is an alias for get_option()
. It is recommended to use get_option()
instead.
Examples
Get the site title
This example shows how to get the site title using get_settings().
$site_title = get_settings('blogname'); echo "The site title is: " . $site_title;
Get the site description
This example shows how to get the site description using get_settings().
$site_description = get_settings('blogdescription'); echo "The site description is: " . $site_description;
Get the site’s admin email
This example shows how to get the admin email using get_settings().
$admin_email = get_settings('admin_email'); echo "The admin email is: " . $admin_email;
Get the site’s posts per page
This example shows how to get the number of posts displayed per page using get_settings().
$posts_per_page = get_settings('posts_per_page'); echo "The number of posts per page is: " . $posts_per_page;
Get the site’s default category
This example shows how to get the default category for new posts using get_settings().
$default_category = get_settings('default_category'); echo "The default category for new posts is: " . $default_category;