当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムWordSlack #docs チャンネルでお知らせください。</p>

関数リファレンス

提供: WordPress Codex 日本語版
2008年5月4日 (日) 02:54時点におけるBono (トーク | 投稿記録)による版 (4 版)

移動先: 案内検索

このページ「関数リファレンス」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています


WordPress のファイルには、便利な PHP 関数がたくさん定義されています。テンプレートタグとして知られる一部の関数は、特に WordPress テーマ用に定義されているものです。また、主にプラグインの開発に用いるアクションフック・フィルターフックに関する関数(プラグイン API)もあります。あとは WordPress のコア機能の形成に使われます。

コアの WordPress 関数の多くはプラグイン開発にも便利で、ものによってはテーマの開発にも使えるかもしれません。このページは、コア関数の大部分をカテゴリ別に一覧表にしたものです。関数名から別ページの詳細説明へリンクしているものもあります。各カテゴリは、関数が書かれているコアファイル(WordPress のディレクトリの wp-includes 内にあり)の一覧でもあります。

  • このリファレンスは WordPress バージョン 2.1 を対象としており、非推奨となった関数は含まれていません。WordPress バージョン 2.0.x 向けの不完全なページは Function Reference 2.0.x(英語)にあります。
  • テンプレートタグに掲載しているテンプレート用の関数(wp-includes/*_template.php にあるもの)は、以下の一覧には載せていません。
  • WordPress Functions History Tool(非公式ツール)は、ある関数が追加/削除された時点を知るのに役立ちます。

You can help make this page more complete!

Here are some things you can do to help:

  • Add documentation to un-documented functions, by creating sub-pages or at least by adding short comments in the lists below. If you create a subpage for a function, please include information and examples of usage of that function, if possible, per the examples found in Template Tags.
  • List more functions here, following the category structure.
  • Remove functions from the list, if you think they could not possibly be useful to plugin developers, or if they have been deprecated.
  • Correct errors by moving functions to better categories where appropriate, and of course fixing typos. Note that it is OK for a function to appear in more than one category.

Read Contributing to WordPress to find out more about how you can contribute to the effort!


Functions by category

Post, Page, and Attachment Functions

These functions are contained in formatting.php, post.php. See also Template Tags.

Category, Tag and Taxonomy Functions

Functions surrounding the WordPress Terms tables, encompassing categories and tags for classifying posts, pages, links, etc.

Category functions in category.php.

  • get_all_category_ids
  • &get_categories($args='') /en
  • &get_category
  • get_category_by_path
  • get_category_by_slug
  • get_cat_ID($cat_name='General') - Get the ID of a category from its name
  • get_cat_name($cat_id) - get the name of a category from its ID
  • cat_is_ancestor_of /en

Tag Functions in category.php

  • &get_tags
  • &get_tag

Term Functions in taxonomy.php

  • is_taxonomy - Checks that the taxonomy name exists
  • is_taxonomy_hierarchical - Whether the taxonomy object is hierarchical
  • &get_term
  • get_term_by
  • get_term_children - Merge all term children into a single array.
  • &get_terms
  • is_term - Check if Term exists
  • wp_get_object_terms - Returns the terms associated with the given object(s), in the supplied taxonomies

Other Category Functions


User and Author Functions

These functions are in user.php, pluggable.php, registration.php. See also Template Functions.

Feed Functions

These functions are in functions.php, feed.php, rss.php

  • fetch_rss /en -- retrieve an RSS feed from a URL with automatic caching (included in rss_functions.php)
  • wp_rss /en -- retrieve and display an RSS feed as an unordered list (included in rss_functions.php)
  • get_rss /en -- retrieve and display an RSS feed as a list (ordering optional) (included in rss_functions.php)
  • do_feed
  • do_feed_rdf
  • do_feed_rss
  • do_feed_rss2
  • do_feed_atom
  • get_bloginfo_rss
  • bloginfo_rss
  • get_the_title_rss
  • the_title_rss
  • the_content_rss
  • the_excerpt_rss
  • permalink_single_rss
  • comment_link
  • get_comment_author_rss
  • comment_author_rss
  • comment_text_rss
  • comments_rss_link
  • comments_rss
  • get_author_rss_link
  • get_category_rss_link /en
  • get_category_feed_link /en(2.5 or later)
  • get_the_category_rss
  • the_category_rss
  • rss_enclosure
  • get_search_feed_link (2.5 or later)
  • get_search_comments_feed_link (2.5 or later)

Comment, Ping, and Trackback Functions

These functions are found in comment.php, functions.php, post.php. See also Template Functions.

  • check_comment
  • get_approved_comments /en
  • get_comment /en
  • get_lastcommentmodified
  • sanitize_comment_cookies
  • wp_allow_comment
  • wp_delete_comment
  • wp_get_comment_status
  • wp_get_current_commenter
  • wp_insert_comment
  • wp_filter_comment
  • wp_throttle_comment_flood
  • wp_new_comment
  • wp_set_comment_status
  • wp_update_comment
  • wp_update_comment_count
  • discover_pingback_server_uri
  • do_all_pings
  • do_trackbacks
  • generic_ping
  • pingback
  • privacy_ping_filter
  • trackback
  • weblog_ping
  • do_enclose
  • add_ping
  • get_enclosed
  • get_pung
  • get_to_ping
  • trackback_url_list

Action, Filter, and Plugin Functions

These functions are contained in plugin.php. See also Plugin API.

Theme-Related Functions

These functions are found in theme.php.

  • get_stylesheet
  • get_stylesheet_directory
  • get_stylesheet_directory_uri
  • get_stylesheet_uri
  • get_locale_stylesheet_uri
  • get_template
  • get_template_directory
  • get_template_directory_uri
  • get_theme_data /en
  • get_themes
  • get_theme
  • get_current_theme
  • get_theme_root
  • get_theme_root_uri
  • get_query_template
  • get_404_template
  • get_archive_template
  • get_author_template
  • get_category_template
  • get_date_template
  • get_home_template
  • get_page_template
  • get_paged_template
  • get_search_template
  • get_single_template
  • get_attachment_template
  • get_comments_popup_template
  • load_template
  • locale_stylesheet
  • validate_current_theme
  • get_theme_mod
  • set_theme_mod
  • get_header_textcolor
  • get_header_image
  • header_image
  • add_custom_image_header


Formatting Functions

These functions are contained in formatting.php, functions.php, kses.php.

Miscellaneous Functions

These functions are contained in formatting.php, functions.php, bookmarks.php, cron.php, l10n.php, user.php, pluggable.php

Time/Date Functions

  • get_gmt_from_date - Changes timezone for a datetime string, from local time to gmt.
  • get_date_from_gmt - Changes timezone for a datetime string, from gmt to local time.
  • iso8601_timezone_to_offset
  • iso8601_to_datetime
  • human_time_diff
  • mysql2date
  • current_time /en
  • date_i18n
  • get_weekendstartend
  • get_lastpostdate
  • get_lastpostmodified
  • is_new_day

Serialization

  • maybe_serialize
  • maybe_unserialize
  • is_serialized
  • is_serialized_string

Options

XMLRPC

  • xmlrpc_getposttitle
  • xmlrpc_getpostcategory
  • xmlrpc_removepostdata
  • user_pass_ok

Localization

See also Translating WordPress.

  • get_locale
  • __
  • _e
  • _ngettext
  • load_textdomain
  • load_default_textdomain
  • load_plugin_textdomain
  • load_theme_textdomain

Cron (Scheduling)

Miscellaneous

  • gzip_compression
  • make_url_footnote
  • wp_get_http_headers
  • add_query_arg
  • remove_query_arg
  • wp_remote_fopen
  • wp
  • status_header
  • nocache_headers
  • cache_javascript_headers
  • get_num_queries
  • bool_from_yn - converts a "Y/N" variable into boolean true/false
  • do_robots
  • is_blog_installed
  • wp_nonce_url
  • wp_nonce_field
  • wp_referer_field
  • wp_original_referer_field
  • wp_get_referer
  • wp_get_original_referer
  • wp_mkdir_p
  • wp_upload_dir
  • wp_upload_bits
  • wp_check_filetype
  • wp_explain_nonce
  • wp_nonce_ays
  • wp_die
  • get_bookmark
  • get_bookmarks
  • wp_mail /en
  • check_admin_referer
  • check_ajax_referer
  • wp_redirect /en
  • wp_get_cookie_login
  • wp_setcookie
  • wp_clearcookie
  • wp_notify_postauthor
  • wp_notify_moderator
  • wp_new_user_notification
  • wp_verify_nonce
  • wp_create_nonce
  • wp_salt
  • wp_hash

Classes

The following classes were created by WordPress developers, and are found in files capabilities.php, classes.php, class-snoopy.php, locale.php, query.php, rewrite.php, script-loader.phpcode>, wp-db.php:

  • WP - general request handling
  • WP_Ajax_Response - AJAX handling
  • WP_Object_Cache /en (formerly WP_Cache) - Object cache (and functions wp_cache_add, wp_cache_close, wp_cache_delete, wp_cache_flush, wp_cache_get, wp_cache_init, wp_cache_replace, wp_cache_set)
  • WP_Error - error handling (and function is_wp_error)
  • WP_Locale - handles date and time locales
  • WP_Query /en - Request parsing and manipulation, posts fetching (with functions get_query_var, query_posts, have_posts, in_the_loop, rewind_posts, the_post, wp_old_slug_redirect, setup_postdata, as well as the Conditional Tags is_*)
  • WP_Rewrite /en - Rewrite rules (and functions add_rewrite_rule, add_rewrite_tag, add_feed, add_rewrite_endpoint, url_to_postid)
  • WP_Roles, WP_Role, WP_User - Users and capabilities (and functions map_meta_cap, current_user_can, get_role, add_role, remove_role)
  • WP_Scripts - JavaScript loading (and functions wp_print_scripts, wp_register_script, wp_deregister_script, wp_enqueue_script /en)
  • Walker /en, Walker_Page, Walker_PageDropdown, Walker_Category, Walker_CategoryDropdown - Display tree-like data
  • wpdb /en - Database interface

The following classes were created by outside developers, and are found in files class-IXR.php, class-pop3.php, class-snoopy.php, gettext.php, rss.php, streams.php:

  • IXR - XML-RPC Classes, including IXR_Value, IXR_Message, IXR_Server, IXR_IntrospectionServer, IXR_Request, IXR_Client, IXR_ClientMulticall, IXR_Error, IXR_Date, IXR_Base64
  • Snoopy - HTTP client
  • gettext_reader (part of PHP-gettext) - Localization Class
  • RSS Classes (MagpieRSS and RSSCache) (and functions fetch_rss, is_info, is_success, is_redirect, is_error, is_client_error, is_server_error, parse_w3cdtf, wp_rss, get_rss)
  • POP3: SquirrelMail wrapper
  • StreamReader, StringReader, FileReader, CachedFileReader

テンプレート:stub

最新英語版: WordPress Codex » Function Reference最新版との差分