商品カテゴリー すべての商品 WordPressプラグイン PHPツール Javascriptツール

WordPressの標準で利用できるグローバル変数一覧

▼調査対象 WordPress v6.7.1 (最新版:2024/12/10現在)
標準で利用できるグローバル変数を調べてみました。
CTRL+F で検索、クリックでソースコードを確認できます。

WordPressの全グローバル変数のリスト

スーパーグローバル変数はPHPが設定している変数で、どこでも使える変数です。
通常のグローバル変数は global $wp; のように宣言する必要があります。

変数名 概要
$PHP_SELF/index.php $_SERVER[‘PHP_SELF’]の値 wp-includes/load.php
$_COOKIEスーパーグローバル変数
$_FILESスーパーグローバル変数
$_GETスーパーグローバル変数
$_POSTスーパーグローバル変数
$_REQUESTスーパーグローバル変数
$_SERVERSERVER_SOFTWARE, REQUEST_URI, PYTHONIOENCODING, HTTP_HOST, HTTP_CONNECTION, HTTP_CACHE_CONTROL, HTTP_SEC_CH_UA, HTTP_SEC_CH_UA_MOBILE, HTTP_SEC_CH_UA_PLATFORM, HTTP_UPGRADE_INSECURE_REQUESTS, HTTP_USER_AGENT, HTTP_ACCEPT, HTTP_SEC_FETCH_SITE, HTTP_SEC_FETCH_MODE, HTTP_SEC_FETCH_USER, HTTP_SEC_FETCH_DEST, HTTP_ACCEPT_ENCODING, HTTP_ACCEPT_LANGUAGE, HTTP_COOKIE, PATH, SERVER_SIGNATURE, SERVER_NAME, SERVER_ADDR, SERVER_PORT, REMOTE_ADDR, DOCUMENT_ROOT, REQUEST_SCHEME, CONTEXT_PREFIX, CONTEXT_DOCUMENT_ROOT, SERVER_ADMIN, SCRIPT_FILENAME, REMOTE_PORT, GATEWAY_INTERFACE, SERVER_PROTOCOL, REQUEST_METHOD, QUERY_STRING, SCRIPT_NAME, PHP_SELF, REQUEST_TIME_FLOAT, REQUEST_TIMEスーパーグローバル変数
$_wp_additional_image_sizes1536×1536, 2048×2048
$_wp_deprecated_widgets_callbackswp_widget_pages, wp_widget_pages_control, wp_widget_calendar, wp_widget_calendar_control, wp_widget_archives, wp_widget_archives_control, wp_widget_links, wp_widget_meta, wp_widget_meta_control, wp_widget_search, wp_widget_recent_entries, wp_widget_recent_entries_control, wp_widget_tag_cloud, wp_widget_tag_cloud_control, wp_widget_categories, wp_widget_categories_control, wp_widget_text, wp_widget_text_control, wp_widget_rss, wp_widget_rss_control, wp_widget_recent_comments, wp_widget_recent_comments_control
$_wp_post_type_featurespost, page, attachment, attachment:audio, attachment:video, revision, nav_menu_item, custom_css, customize_changeset, oembed_cache, user_request, wp_block, wp_template, wp_template_part, wp_global_styles, wp_navigation, wp_font_family, wp_font_face
$_wp_registered_theme_featuresalign-wide, automatic-feed-links, block-templates, block-template-parts, custom-background, custom-header, custom-logo, customize-selective-refresh-widgets, dark-editor-style, disable-custom-colors, disable-custom-font-sizes, disable-custom-gradients, disable-layout-styles, editor-color-palette, editor-font-sizes, editor-gradient-presets, editor-spacing-sizes, editor-styles, html5, post-formats, post-thumbnails, responsive-embeds, title-tag, wp-block-styles
$_wp_sidebars_widgets
$_wp_theme_featurescore-block-patterns
$_wp_using_ext_object_cache
$allowedentitynamesnbsp, iexcl, cent, pound, curren, yen, brvbar, sect, uml, copy, ordf, laquo, not, shy, reg, macr, deg, plusmn, acute, micro, para, middot, cedil, ordm, raquo, iquest, Agrave, Aacute, Acirc, Atilde, Auml, Aring, AElig, Ccedil, Egrave, Eacute, Ecirc, Euml, Igrave, Iacute, Icirc, Iuml, ETH, Ntilde, Ograve, Oacute, Ocirc, Otilde, Ouml, times, Oslash, Ugrave, Uacute, Ucirc, Uuml, Yacute, THORN, szlig, agrave, aacute, acirc, atilde, auml, aring, aelig, ccedil, egrave, eacute, ecirc, euml, igrave, iacute, icirc, iuml, eth, ntilde, ograve, oacute, ocirc, otilde, ouml, divide, oslash, ugrave, uacute, ucirc, uuml, yacute, thorn, yuml, quot, amp, lt, gt, apos, OElig, oelig, Scaron, scaron, Yuml, circ, tilde, ensp, emsp, thinsp, zwnj, zwj, lrm, rlm, ndash, mdash, lsquo, rsquo, sbquo, ldquo, rdquo, bdquo, dagger, Dagger, permil, lsaquo, rsaquo, euro, fnof, Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta, Iota, Kappa, Lambda, Mu, Nu, Xi, Omicron, Pi, Rho, Sigma, Tau, Upsilon, Phi, Chi, Psi, Omega, alpha, beta, gamma, delta, epsilon, zeta, eta, theta, iota, kappa, lambda, mu, nu, xi, omicron, pi, rho, sigmaf, sigma, tau, upsilon, phi, chi, psi, omega, thetasym, upsih, piv, bull, hellip, prime, Prime, oline, frasl, weierp, image, real, trade, alefsym, larr, uarr, rarr, darr, harr, crarr, lArr, uArr, rArr, dArr, hArr, forall, part, exist, empty, nabla, isin, notin, ni, prod, sum, minus, lowast, radic, prop, infin, ang, and, or, cap, cup, int, sim, cong, asymp, ne, equiv, le, ge, sub, sup, nsub, sube, supe, oplus, otimes, perp, sdot, lceil, rceil, lfloor, rfloor, lang, rang, loz, spades, clubs, hearts, diams, sup1, sup2, sup3, frac14, frac12, frac34, there4
$allowedposttagsaddress, a, abbr, acronym, area, article, aside, audio, b, bdo, big, blockquote, br, button, caption, cite, code, col, colgroup, del, dd, dfn, details, div, dl, dt, em, fieldset, figure, figcaption, font, footer, h1, h2, h3, h4, h5, h6, header, hgroup, hr, i, img, ins, kbd, label, legend, li, main, map, mark, menu, nav, object, p, pre, q, rb, rp, rt, rtc, ruby, s, samp, span, section, small, strike, strong, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, title, tr, track, tt, u, ul, ol, var, video 投稿できるタグのリスト
$allowedtagsa, abbr, acronym, b, blockquote, cite, code, del, em, i, q, s, strike, strong allowed_tags() で許可されるタグのリスト
$allowedxmlentitynamesamp, lt, gt, apos, quot
$block_core_latest_posts_excerpt_length0
$blog_id1
$html5_named_character_referencesWP_Token_Map オブジェクトwp-includes/class-wp-token-map.php
$is_IE ブラウザがInternet Explorerかの判定
$is_IIS サーバーがIISかの判定
$is_NS4 ブラウザがNetscape 4.xかの判定
$is_apache1 Webサーバーがapacheかの判定
$is_caddy Webサーバーがcaddyかの判定
$is_chrome1 ブラウザがGoogle Chromeかの判定
$is_edge ブラウザがMicrosoft Edgeかの判定
$is_gecko ブラウザにGeckoが含まれるかの判定
$is_iis7 サーバーがIIS7かの判定
$is_iphone 端末がiPhoneかの判定
$is_lynx ブラウザがLynxかの判定
$is_macIE ブラウザがMac版のInternet Explorerかの判定
$is_nginx WebサーバーがNginxかの判定
$is_opera ブラウザがOperaかの判定
$is_safari ブラウザがSafariかの判定
$is_winIE ブラウザがWindows版のInternet Explorerかの判定
$l10ndefault
$l10n_unloaded
$localeja
$month01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12
$month_abbrev1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月
$pagenowindex.php
$post_type_meta_capsedit_post, read_post, delete_post, edit_page, read_page, delete_page, customize, edit_block, read_block, delete_block, edit_template, read_template, delete_template
$required_mysql_version5.5.5 最低限必要なMySQLのバージョン
$required_php_version7.2.24 最低限必要なPHPのバージョン
$rest_insert_wp_navigation_core_callbackblock_core_navigation_update_ignore_hooked_blocks_meta
$rest_prepare_wp_navigation_core_callbackblock_core_navigation_insert_hooked_blocks_into_rest_response
$shortcode_tagswp_caption, caption, gallery, playlist, audio, video, embed
$table_prefixwp_
$theme/wp-content/themes/fnotes
$timestart177777777.777 起動開始時刻 wp-settings.php wp-includes/load.php timer_stop() で終了までの時間を取得できる
$tinymce_version49110-20201110
$upgrading
$vWP_HTTP_IXR_Client オブジェクトwp-includes/class-wp-http-ixr-client.php
$weekday日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日
$weekday_abbrev日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日
$weekday_initial日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日
$wpWP オブジェクトwp-includes/class-wp.php
$wp_actionsmuplugins_loaded, registered_taxonomy, registered_taxonomy_category, registered_taxonomy_post_tag, registered_taxonomy_nav_menu, registered_taxonomy_link_category, registered_taxonomy_post_format, registered_taxonomy_wp_theme, registered_taxonomy_wp_template_part_area, registered_taxonomy_wp_pattern_category, registered_post_type, registered_post_type_post, registered_post_type_page, registered_post_type_attachment, registered_post_type_revision, registered_post_type_nav_menu_item, registered_post_type_custom_css, registered_post_type_customize_changeset, registered_post_type_oembed_cache, registered_post_type_user_request, registered_post_type_wp_block, registered_post_type_wp_template, registered_post_type_wp_template_part, registered_post_type_wp_global_styles, registered_post_type_wp_navigation, registered_post_type_wp_font_family, registered_post_type_wp_font_face, plugins_loaded, sanitize_comment_cookies, wp_roles_init, setup_theme, unload_textdomain, load_textdomain
$wp_current_filter
$wp_db_version58975 WordPressのデータベースのバージョン情報
$wp_did_header1
$wp_embedWP_Embed オブジェクトwp-includes/class-wp-embed.php
$wp_filterquery, pre_term_name, pre_comment_author_name, pre_link_name, pre_link_target, pre_link_rel, pre_user_display_name, pre_user_first_name, pre_user_last_name, pre_user_nickname, term_name, comment_author_name, link_name, link_target, link_rel, user_display_name, user_first_name, user_last_name, user_nickname, pre_term_description, pre_link_description, pre_link_notes, pre_user_description, pre_comment_author_email, pre_user_email, comment_author_email, user_email, pre_comment_author_url, pre_user_url, pre_link_url, pre_link_image, pre_link_rss, pre_post_guid, user_url, link_url, link_image, link_rss, comment_url, post_guid, pre_term_slug, wp_insert_post_data, pre_post_type, pre_post_status, pre_post_comment_status, pre_post_ping_status, pre_post_mime_type, post_mime_type, register_meta_args, admin_init, wp_update_user_counts, user_register, deleted_user, added_post_meta, updated_post_meta, deleted_post_meta, added_user_meta, updated_user_meta, deleted_user_meta, add_user_role, set_user_role, remove_user_role, added_term_meta, updated_term_meta, deleted_term_meta, get_term_metadata, add_term_metadata, update_term_metadata, delete_term_metadata, get_term_metadata_by_mid, update_term_metadata_by_mid, delete_term_metadata_by_mid, update_term_metadata_cache, added_comment_meta, updated_comment_meta, deleted_comment_meta, content_save_pre, excerpt_save_pre, comment_save_pre, pre_comment_content, comment_author, link_description, link_notes, bloginfo, wp_title, document_title, widget_title, the_content, the_title, comment_text, single_post_title, single_cat_title, single_tag_title, single_month_title, nav_menu_attr_title, nav_menu_description, term_description, get_the_post_type_description, term_name_rss, wp_insert_post_parent, wp_update_term_parent, the_excerpt, get_the_excerpt, the_post_thumbnail_caption, comment_excerpt, list_cats, wp_sprintf, widget_text, widget_text_content, widget_block_content, block_type_metadata, wp_get_custom_css, the_title_rss, the_content_rss, the_content_feed, the_excerpt_rss, comment_author_rss, comment_text_rss, bloginfo_rss, the_author, the_guid, wp_mail, wp_robots, publish_post, publish_page, wp_ajax_save-widget, wp_ajax_widgets-order, customize_save_after, rest_after_save_widget, rest_delete_widget, rest_save_sidebar, wp_default_autoload_value, option_ping_sites, option_blog_charset, option_home, option_siteurl, tiny_mce_before_init, teeny_mce_before_init, pre_kses, sanitize_title, check_comment_flood, comment_flood_filter, comment_email, option_tag_base, option_category_base, the_posts, comments_open, pings_open, editable_slug, pingback_ping_source_uri, xmlrpc_pingback_error, title_save_pre, transition_comment_status, http_request_host_is_external, xmlrpc_rsd_apis, wp_head, template_redirect, auth_cookie_malformed, auth_cookie_expired, auth_cookie_bad_username, auth_cookie_bad_hash, auth_cookie_valid, application_password_failed_authentication, application_password_did_authenticate, rest_authentication_errors, publish_future_post, wp_footer, wp_print_footer_scripts, init, switch_theme, start_previewing_theme, after_switch_theme, wp_enqueue_scripts, wp_print_styles, login_head, login_footer, login_init, rss2_head, commentsrss2_head, rss_head, rdf_header, atom_head, comments_atom_head, opml_head, app_head, update_option_home, do_feed_rdf, do_feed_rss, do_feed_rss2, do_feed_atom, do_pings, do_all_pings, do_robots, do_favicon, set_comment_cookies, sanitize_comment_cookies, plugins_loaded, shutdown, wp_after_insert_post, post_updated, transition_post_status, comment_form, user_request_action_confirmed, wp_privacy_personal_data_exporters, wp_privacy_personal_data_erasers, wp_privacy_delete_old_export_files, wp_scheduled_delete, wp_scheduled_auto_draft_delete, importer_scheduled_cleanup, upgrader_scheduled_cleanup, delete_expired_transients, delete_post, delete_term, begin_fetch_post_thumbnail_html, end_fetch_post_thumbnail_html, attachment_updated, pre_option_gmt_offset, default_option_link_manager_enabled, pre_option_embed_autourls, heartbeat_settings, admin_enqueue_scripts, heartbeat_send, heartbeat_nopriv_send, authenticate, determine_current_user, split_shared_term, wp_split_shared_term_batch, wp_update_comment_type_batch, comment_post, after_password_reset, register_new_user, edit_user_created_user, rest_api_init, parse_request, setup_theme, after_setup_theme, wp_loaded, delete_attachment, save_post, update_option_start_of_week, update_option_gmt_offset, admin_menu, before_delete_post, wp_trash_post, change_locale, request, term_link, get_post_format, get_terms, wp_get_object_terms, set_current_user, wp_default_scripts, enqueue_block_assets, enqueue_block_editor_assets, wp_print_scripts, print_scripts_array, customize_controls_print_styles, admin_head, block_editor_settings_all, wp_default_styles, style_loader_src, force_filtered_html_on_import, theme_wp_navigation_templates, wp_playlist_scripts, customize_controls_enqueue_scripts, plupload_default_settings, nav_menu_item_id, nav_menu_css_class, widgets_init, before_signup_header, activate_header, wp_body_open, in_admin_header, media_buttons, image_send_to_editor, media_send_to_editor, rest_pre_serve_request, embed_oembed_html, embed_head, enqueue_embed_scripts, embed_content_meta, embed_footer, excerpt_more, the_excerpt_embed, oembed_dataparse, oembed_response_data, pre_oembed_result, user_has_cap, render_block_context, pre_wp_unique_post_slug, save_post_wp_template_part, rest_wp_navigation_item_schema, render_block, wp_save_post_revision_post_has_changed, _wp_put_post_revision, wp_creating_autosave, wp_restore_post_revision, deleted_post, rest_pre_insert_wp_template, rest_pre_insert_wp_template_part, rest_pre_insert_wp_navigation, rest_prepare_wp_navigation, wp_version_check, load-plugins.php, load-update.php, load-update-core.php, wp_update_plugins, load-themes.php, wp_update_themes, update_option_WPLANG, wp_maybe_auto_update, wp_delete_temp_updater_backups, dynamic_sidebar_before, dynamic_sidebar_after, comment_form_defaults, _wp_post_revision_fields, _wp_post_revision_field_footnotes, render_block_data, get_block_type_variations, theme_mod_custom_logo, pre_set_theme_mod_custom_logo, delete_option_site_logo, pre_render_block, render_block_core/group, render_block_core/image, block_type_metadata_settings, edit_form_advanced, edit_page_form, upgrader_process_complete, wp_ajax_add-category, wp_ajax_add-post_tag, wp_ajax_add-nav_menu, wp_ajax_add-link_category, wp_ajax_add-post_format, wp_ajax_add-wp_theme, wp_ajax_add-wp_template_part_area, wp_ajax_add-wp_pattern_category, future_post, future_page, future_attachment, future_revision, future_nav_menu_item, future_custom_css, future_customize_changeset, future_oembed_cache, future_user_request, future_wp_block, future_wp_template, future_wp_template_part, future_wp_global_styles, future_wp_navigation, future_wp_font_family, future_wp_font_face, wp_logout, login_form_exit_recovery_mode, recovery_mode_clean_expired_keys, _admin_menu, update_option_theme_mods_fnotes, delete_option_theme_mods_fnotes, locale, determine_locale
$wp_filterswp_fatal_error_handler_enabled, enable_wp_debug_mode_checks, wp_doing_ajax, incompatible_sql_modes, enable_loading_object_cache_dropin, pre_wp_load_alloptions, wp_autoload_values_to_autoload, query, pre_cache_alloptions, alloptions, pre_option_siteurl, pre_option, option_siteurl, pre_site_option_siteurl, default_site_option_siteurl, site_option_siteurl, pre_option_home, option_home, register_taxonomy_args, register_category_taxonomy_args, gettext, gettext_default, gettext_with_context, gettext_with_context_default, taxonomy_labels_category, register_post_tag_taxonomy_args, taxonomy_labels_post_tag, register_nav_menu_taxonomy_args, taxonomy_labels_nav_menu, register_link_category_taxonomy_args, taxonomy_labels_link_category, register_post_format_taxonomy_args, taxonomy_labels_post_format, register_wp_theme_taxonomy_args, taxonomy_labels_wp_theme, register_wp_template_part_area_taxonomy_args, taxonomy_labels_wp_template_part_area, register_wp_pattern_category_taxonomy_args, taxonomy_labels_wp_pattern_category, sanitize_key, register_post_type_args, register_post_post_type_args, post_type_labels_post, register_page_post_type_args, post_type_labels_page, pre_option_wp_attachment_pages_enabled, option_wp_attachment_pages_enabled, register_attachment_post_type_args, post_type_labels_attachment, register_revision_post_type_args, post_type_labels_revision, register_nav_menu_item_post_type_args, post_type_labels_nav_menu_item, register_custom_css_post_type_args, post_type_labels_custom_css, register_customize_changeset_post_type_args, post_type_labels_customize_changeset, register_oembed_cache_post_type_args, post_type_labels_oembed_cache, register_user_request_post_type_args, post_type_labels_user_request, register_wp_block_post_type_args, post_type_labels_wp_block, register_wp_template_post_type_args, post_type_labels_wp_template, register_wp_template_part_post_type_args, post_type_labels_wp_template_part, register_wp_global_styles_post_type_args, post_type_labels_wp_global_styles, register_wp_navigation_post_type_args, post_type_labels_wp_navigation, register_wp_font_family_post_type_args, post_type_labels_wp_font_family, register_wp_font_face_post_type_args, post_type_labels_wp_font_face, theme_root, pre_get_scheduled_event, pre_option_cron, option_cron, recovery_mode_email_rate_limit, recovery_mode_email_link_ttl, pre_option_active_plugins, option_active_plugins, pre_option_hack_file, option_hack_file, pre_option_blog_charset, option_blog_charset, load_default_widgets, load_default_embeds, wp_audio_extensions, wp_audio_embed_handler, wp_video_extensions, wp_video_embed_handler, pre_option_permalink_structure, option_permalink_structure, pre_option_wp_user_roles, option_wp_user_roles, pre_option_stylesheet, option_stylesheet, pre_option_template, option_template, template, template_directory, stylesheet, stylesheet_directory, pre_determine_locale, pre_option_WPLANG, option_WPLANG, locale, determine_locale, override_unload_textdomain, pre_load_textdomain, override_load_textdomain, load_textdomain_mofile, translation_file_format, load_translation_file, pre_get_language_files_from_path, get_available_languages
$wp_interactivityWP_Interactivity_API オブジェクトwp-includes/interactivity-api/class-wp-interactivity-api.php
$wp_local_packageja
$wp_localeWP_Locale オブジェクトwp-includes/class-wp-locale.php
$wp_locale_switcherWP_Locale_Switcher オブジェクトwp-includes/class-wp-locale-switcher.php
$wp_object_cacheWP_Object_Cache オブジェクトwp-includes/class-wp-object-cache.php キャッシュ管理クラス。取得や保存は下記のグローバル関数で行う。実態は変数の共有なので別リクエストと共有したい場合は Transients API を利用する。
wp_cache_add() wp-includes/cache.php wp_cache_set() wp-includes/cache.php wp_cache_replace() wp-includes/cache.php wp_cache_get() wp-includes/cache.php wp_cache_delete() wp-includes/cache.php wp_cache_flush() wp-includes/cache.php
$wp_plugin_paths
$wp_post_statusespublish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed
$wp_post_typespost, page, attachment, revision, nav_menu_item, custom_css, customize_changeset, oembed_cache, user_request, wp_block, wp_template, wp_template_part, wp_global_styles, wp_navigation, wp_font_family, wp_font_face
$wp_queryWP_Query オブジェクトwp-includes/class-wp-query.php その時点で処理中の検索条件や結果が入っている
$wp_registered_sidebars
$wp_registered_widget_controls
$wp_registered_widget_updates
$wp_registered_widgets
$wp_rewriteWP_Rewrite オブジェクトwp-includes/class-wp-rewrite.php
$wp_rolesWP_Roles オブジェクトwp-includes/class-wp-roles.php
$wp_script_modulesWP_Script_Modules
$wp_stylesheet_path/wp-content/themes/fnotes テーマ(子)ディレクトリのパス
$wp_taxonomiescategory, post_tag, nav_menu, link_category, post_format, wp_theme, wp_template_part_area, wp_pattern_category
$wp_template_path/wp-content/themes/fnotes テーマ(親)ディレクトリのパス
$wp_textdomain_registryWP_Textdomain_Registry オブジェクトwp-includes/class-wp-textdomain-registry.php
$wp_the_queryWP_Query オブジェクトwp-includes/class-wp-query.php メインクエリ。現在のリクエストに応じた検索条件や結果が入っている。 wp-includes/functions.php
$wp_theme_directories/wp-content/themes
$wp_user_roles
$wp_version6.7.1 WordPressのバージョン情報
$wp_widget_factoryWP_Widget_Factory オブジェクトwp-includes/class-wp-widget-factory.php
$wpdbwpdb オブジェクトwp-includes/class-wpdb.php データベースの操作用クラス。SQLを直接実行したい場合に利用できる。
著者情報
著者情報

Webサイト開発者。PHP/Javascript の開発実績2,000件以上。クラウドソーシング経由では700件ほどの受注実績あり。