- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
関数リファレンス/get option
目次
Description
A safe way of getting values for a named option from the options database table. If the desired option does not exist, or no value is associated with it, FALSE will be returned.
Usage
%%% <?php echo get_option( $show, $default ); ?> %%%
Parameters
- $show
- (string) (必須) Name of the option to retrieve. A list of valid default options can be found at the Option Reference.
- 初期値: なし
- $default
- (mixed) (optional) The default value to return if no value is returned (ie. the option is not in the database).
- 初期値: false
Values
More information: Option_Reference
Examples
Show Blog Title
Displays your blog's title in a <h1> tag.
%%%<?php echo get_option('blogname'); ?>
%%%Show Character Set
Displays the character set your blog is using (ex: UTF-8)
%%%Character set: <?php echo get_option('blog_charset'); ?>
%%%Retrieve Administrator E-mail
Retrieve the e-mail of the blog administrator, storing it in a variable.
%%% <?php $admin_email = get_option('admin_email'); ?> %%%
Changelog
- since 1.5.0
Source Code
get_option()
is located in
-
wp-includes/functions.php
(5.3: the latest stable version) -
構文エラー: "trunk" は認識できません/src/wp-includes/functions.php wp-includes/functions.php
(the development version)
最新英語版: WordPress Codex » Function Reference/get_option (最新版との差分)
Related
Options API: add_option() /en, add_site_option() /en, delete_option() /en, delete_site_option() /en, form_option() /en, get_site_option() /en, get_site_url(), get_user_option() /en, get_option() /en, update_option() /en, update_site_option() /en, update_user_option() /en, wp_load_alloptions() /en