目次
- 1 index.php
- 2 wp-blog-header.php
- 3 wp-load.php
- 4 wp-config.php
- 5 wp-settings.php
- 6 wp-includes/functions.php
- 7 wp-includes/vars.php
- 8 functions.php (child)
- 9 functions.php (parent)
- 9.1 wp()
- 9.2 $wp->main()
- 9.3 $wp->parse_request()
- 9.4 $wp->send_headers()
- 9.5 $wp->query_posts()
- 9.6 $wp->build_query_string()
- 9.7 $wp_the_query->query( $this->query_vars )
- 9.8 $wp_query->get_posts()
- 9.9 $wp_query->parse_query()
- 9.10 if ( ! $q[‘suppress_filters’] )
- 9.11 if ( ! empty( $q[‘s’] ) )
- 9.12 if ( ! $q[‘suppress_filters’] )
- 9.13 $wp->handle_404()
- 9.14 $wp->register_globals()
- 10 wp-includes/template-loader.php
- 11 do_robots()
- 12 get_header( $name = null )
- 13 get_template_part( $slug, $name = null )
- 14 get_search_form( $echo = true )
- 15 wp_loginout( $redirect = ”, $echo = true )
- 16 wp_logout_url( $redirect = ” )
- 17 wp_login_url( $redirect = ”, $force_reauth = false )
- 18 wp_registration_url()
- 19 wp_login_form( $args = array() )
- 20 wp_lostpassword_url( $redirect = ” )
- 21 wp_register( $before = ‘‘, $after = ‘‘, $echo = true )
- 22 wp_meta()
- 23 get_sidebar()
- 24 get_footer( $name = null )
- 25 wp-admin/index.php
- 26 wp-admin/admin.php
- 27 wp-load.php
- 28 wp-admin/includes/admin.php
- 29 wp-admin/includes/admin-filters.php
- 30 wp-admin/includes/bookmark.php
- 31 wp-admin/includes/comment.php
- 32 wp-admin/includes/file.php
- 33 wp-admin/includes/image.php
- 34 wp-admin/includes/media.php
- 35 wp-admin/includes/import.php
- 36 wp-admin/includes/misc.php
- 37 wp-admin/includes/options.php
- 38 wp-admin/includes/plugin.php
- 39 wp-admin/includes/post.php
- 40 wp-admin/includes/class-wp-screen.php
- 41 wp-admin/includes/screen.php
- 42 wp-admin/includes/taxonomy.php
- 43 wp-admin/includes/template.php
- 44 wp-admin/includes/class-wp-list-table.php
- 45 wp-admin/includes/class-wp-list-table-compat.php
- 46 wp-admin/includes/list-table.php
- 47 wp-admin/includes/theme.php
- 48 wp-admin/includes/user.php
- 49 wp-admin/includes/class-wp-site-icon.php
- 50 wp-admin/includes/update.php
- 51 wp-admin/menu.php
- 52 wp-admin/includes/menu.php
- 53 wp-admin/admin-header.php
- 54 wp-admin/admin-header.php
- 55 wp-admin/admin-footer.php
- 56 else
- 57 wp-admin/includes/dashboard.php
- 58 wp_add_dashboard_widget
- 59 add_meta_box
- 60 wp-admin/admin-header.php
- 61 wp-admin/menu-header.php
- 62 wp-admin/admin-footer.php
- 63 wp-admin/edit.php
- 64 wp-admin/admin.php
- 65 wp-admin/admin-header.php
- 66 wp-admin/admin-footer.php
- 67 wp-admin/post.php
- 68 wp-admin/admin.php
- 69 wp-admin/edit-form-advanced.php
- 70 wp-admin/admin-header.php
- 71 wp-admin/admin-footer.php
- 72 wp-admin/users.php
- 73 wp-admin/admin.php
- 74 wp-admin/screen.php
- 75 wp-admin/admin-header.php
- 76 wp-admin/admin-footer.php
- 77 wp-admin/user-new.php
- 78 wp-admin/admin.php
- 79 wp-admin/admin-header.php
- 80 wp-admin/admin-footer.php
- 81 wp-admin/user-edit.php
- 82 wp-admin/admin.php
- 83 wp-admin/admin-header.php
- 84 wp-admin/admin-footer.php
- 85 wp-login.php
- 86 wp-load.php
- 87 login_header()
- 88 login_footer()
- 89 wp-admin/admin-ajax.php
- 90 wp-load.php
- 91 wp-admin/includes/admin.php
- 92 wp-admin/includes/ajax-actions.php
- 93 if ( is_user_logged_in() )
- 94 else
index.php
フロントエンドでの処理です。
wp_register( $before = ‘
wp-load.php
によるコアの起動後、テンプレートで呼び出した関数にフックされたアクション・フィルターが呼び出されます。
wp-blog-header.php
wp-load.php
フロントエンド、管理画面共通の処理です。wp-config.php があれば読み込み、なければ wp-admin/setup-config.php を読み込んで WordPress セットアップ画面を表示します。
ABSPATH
wp-config.php
DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, DB_CHARSET, DB_COLLATE
AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY, AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT, NONCE_SALT, WP_DEBUG
wp-settings.php
コアファイルの多くがこのファイルで読み込まれます。
global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version, $wp_local_package
global $wpdb
wp-includes/functions.php
様々な場面で使用される関数群がここで読み込まれます。
wp_upload_dir()
apply_filters( 'upload_dir', $cache[ $key ] )
Filters the uploads directory data.メディアのアップロードディレクトリを変更することができます。例えばユーザーごとにディレクトリを分ける場合にはこのフィルターフックを利用します。
@since 2.0.0
wp_get_mime_types()
apply_filters( 'mime_types', array( ... ) )
Filters the list of mime types and file extensions.メディアにアップロードできるファイルの種類を追加/制限することができます。
@since 3.5.0
get_allowed_mime_types()
apply_filters( 'upload_mimes', $t, $user )
Filters list of allowed mime types and file extensions.
@since 2.0.0
wp_start_object_cache()
global $wp_filter
wp-includes/default-filters.php
デフォルトのアクション・フィルターフックが読み込まれます。
do_action( 'mu_plugin_loaded', $mu_plugin )
Fires once a single must-use plugin has loaded.
@since 5.1.0
do_action( 'muplugins_loaded' )
Fires once all must-use and network-activated plugins have loaded.
@since 2.8.0
wp-includes/vars.php
global $pagenow, $is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE, $is_edge, $is_apache, $is_IIS, $is_iis7, $is_nginx;
do_action( 'plugin_loaded', $plugin )
Fires once a single activated plugin has loaded.
@since 5.1.0
do_action( 'plugins_loaded' )
Fires once activated plugins have loaded.
@since 1.5.0
do_action( 'sanitize_comment_cookies' )
Fires when comment cookies are sanitized.
@since 2.0.11
$GLOBALS['wp_query']
$GLOBALS['wp_rewrite']
$GLOBALS['wp']
$GLOBALS['wp_roles']
do_action( 'setup_theme' )
Fires before the theme is loaded.
@since 2.6.0
$GLOBALS['wp_locale']
functions.php (child)
子テーマの
functions.php
はここで読み込まれます。
functions.php (parent)
子テーマに続いて親テーマの
functions.php
が読み込まれます。
do_action( 'after_theme_setup' )
Fires after the theme is loaded.
@since 3.0.0
do_action( 'init' )
Fires after WordPress has finished loading but before any headers are sent.
@since 1.5.0
wp-includes/defalt-filters.php
で登録される create_initial_post_types
や create_initial_taxonomies
、wp_cron
、rest_api_init
などはここで呼ばれます。
do_action( 'wp_loaded' )
This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
@since 3.0.0
wp()
$wp->main()
$wp->parse_request()
apply_filters( 'do_parse_request', true, $this, $extra_query_vars )
Filters whether to parse the request.
@since 3.5.0
apply_filters( 'query_vars', $this->public_query_vars )
Filters the query variables whitelist before processing.
@since 1.5.0
apply_filters( 'request', $this->query_vars )
Filters the array of parsed query variables.
@since 2.1.0
do_action_ref_array( 'parse_request', array( &$this ) )
Fires once all query variables for the current request have been parsed.REST API へのリクエストの場合にはここにフックされた
@since 2.1.0
rest_api_loaded
関数内で REST_REQUEST
定数が true
にセットされ、さらに rest_api_loaded
関数から呼ばれる WP_REST_Server::serve_request
で Content-Type: application/json
として HTTP レスポンスヘッダーが送信されます。
$wp->send_headers()
apply_filters( 'wp_headers', $headers, $this )
Filters the HTTP headers before they’re sent to the browser.
@since 2.8.0
do_action_ref_array( 'send_headers', array( &$this ) )
Fires once the requested HTTP headers for caching, content type, etc. have been sent.
@since 2.1.0
$wp->query_posts()
$wp->build_query_string()
apply_filters( 'query_string', $this->query_string )
Filters the query string before parsing.
@since 1.5.0
$wp_the_query->query( $this->query_vars )
$wp_query->get_posts()
$wp_query->parse_query()
do_action_ref_array( 'parse_query', array( &$this ) )
Fires after the main query vars have been parsed.
@since 1.5.0
do_action_ref_array( 'pre_get_posts', array( &$this ) )
Fires after the query variable object is created, but before the actual query is run.クエリ変数オブジェクトが生成されたときに呼び出されます。クエリ変数は用意されているのでその中身を見ることはできますが、実際にクエリは実行されていないので、投稿情報はもっていません。
@since 2.0.0
if ( ! $q[‘suppress_filters’] )
apply_filters_ref_array( 'posts_search', array( $search, &$this ) )
Filters the search SQL that is used in the WHERE clause of WP_Query.
@since 3.0.0
if ( ! empty( $q[‘s’] ) )
apply_filters( 'posts_search_orderby', $search_orderby, $this )
Filters the ORDER BY used when ordering search results.
@since 3.7.0
apply_filters_ref_array( 'posts_where', array( $where, &$this ) )
Filters the WHERE clause of the query.
@since 1.5.0
apply_filters_ref_array( 'posts_join', array( $join, &$this ) )
Filters the JOIN clause of the query.
@since 1.5.0
apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) )
Filters the JOIN clause of the comments feed query before sending.
@since 2.2.0
apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) )
Filters the WHERE clause of the comments feed query before sending.
@since 2.2.0
apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) )
Filters the GROUP BY clause of the comments feed query before sending.
@since 2.2.0
apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) )
Filters the ORDER BY clause of the comments feed query before sending.
@since 2.8.0
apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) )
Filters the LIMIT clause of the comments feed query before sending.
@since 2.8.0
apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) )
Filters the WHERE clause of the query.
@since 1.5.0
apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) )
Filters the GROUP BY clause of the query.
@since 2.0.0
apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) )
Filters the JOIN clause of the query.
@since 1.5.0
apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) )
Filters the ORDER BY clause of the query.
@since 1.5.1
apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) )
Filters the DISTINCT clause of the query.
since 2.1.0
apply_filters_ref_array( 'post_limits', array( $limits, &$this ) )
Filters the LIMIT clause of the query.
@since 2.1.0
apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) )
Filters the SELECT clause of the query.
@since 2.1.0
apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) )
Filters all query clauses at once, for convenience.
@since 3.1.0
do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join )
Fires to announce the query’s current selection parameters.データベースから投稿を取得するための選択クエリが準備できたときに呼び出されます。投稿情報はまだ取得されていないため、グローバル変数 $post はセットされていません。
@since 2.3.0
if ( ! $q[‘suppress_filters’] )
apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) )
Filters the WHERE clause of the query.
For use by caching plugins.
@since 2.5.0
apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) )
Filters the GROUP BY clause of the query.
For use by caching plugins.
@since 2.5.0
apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) )
Filters the JOIN clause of the query.
For use by caching plugins.
@since 2.5.0
apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) )
Filters the ORDER BY clause of the query.
For use by caching plugins.
@since 2.5.0
apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) )
Filters the DISTINCT clause of the query.
For use by caching plugins.
@since 2.5.0
apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) )
Filters the SELECT clause of the query.
For use by caching plugins.
@since 2.5.0
apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) )
Filters the LIMIT clause of the query.
For use by caching plugins.
@since 2.5.0
apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) )
Filters all query clauses at once, for convenience.
For use by caching plugins.
@since 3.1.0
apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) )
Filters the completed SQL query before sending.
@since 2.0.0
apply_filters_ref_array( 'posts_pre_query', array( null, &$this ) )
Filters the posts array before the query takes place.Return a non-null value to bypass WordPress’s default post queries.
Filtering functions that require pagination information are encouraged to set the `found_posts` and `max_num_pages` properties of the WP_Query object, passed to the filter by reference. If WP_Query does not perform a database query, it will not have enough information to generate these values itself.
@since 4.6.0
$wp->handle_404()
apply_filters( 'pre_handle_404', false, $wp_query )
Filters whether to short-circuit default header status handling.
@since 4.5.0
$wp->register_globals()
$GLOBALS['query_string'], $GLOBALS['posts'], $GLOBALS['post'], $GLOBALS['request']
do_action_ref_array( 'wp', array( &$this ) )
Fires once the WordPress environment has been set up.
@since 2.1.0
wp-includes/template-loader.php
do_action( 'template_redirect' )
Fires before determining which template to load.
@since 1.5.0
do_action( 'do_robots' )
Fired when the template loader determines a robots.txt request.
@since 2.1.0
wp-includes/default-filters.php
で登録された、wp-includes/functions.php
で定義されている do_robots
関数が呼び出されます。
do_robots()
do_action( 'do_robotstxt' )
Fires when displaying the robots.txt file.
@since 2.1.0
apply_filters( 'robots_txt', $output, $public )
Filters the robots.txt output.
@since 3.0.0
apply_filters( 'exit_on_http_head', true )
Filters whether to allow ‘HEAD’ requests to generate content.
@since 3.5.0
if ( is_robots() )
do_action( 'do_robots' )
Fired when the template loader determines a robots.txt request.
@since 2.1.0
apply_filters( 'template_include', $template )
Filters the path of the current template before including it.
@since 3.0.0
include( $template )
get_header( $name = null )
do_action( 'get_header', $name )
Fires before the header template file is loaded.
@since 2.8.0
get_template_part( $slug, $name = null )
do_action( "get_template_part_{$slug}", $slug, $name )
Fires before the specified template part file is loaded.
get_search_form( $echo = true )
do_action( 'pre_get_search_form' )
Fires before the search form is retrieved, at the start of get_search_form().
@since 3.6.0
apply_filters( 'search_form_format', $format )
Filters the HTML format of the search form.
@since 3.6.0
apply_filters( 'get_search_form', $form )
Filters the HTML output of the search form.
@since 2.7.0
wp_loginout( $redirect = ”, $echo = true )
apply_filters( 'loginout', $link )
Filters the HTML output for the Log In/Log Out link.
@since 1.5.0
wp_logout_url( $redirect = ” )
apply_filters( 'logout_url', $logout_url, $redirect )
Filters the logout URL.
@since 2.8.0
wp_login_url( $redirect = ”, $force_reauth = false )
apply_filters( 'login_url', $login_url, $redirect, $force_reauth )
Filters the login URL.
@since 4.2.0
wp_registration_url()
apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) )
Returns the URL that allows the user to register on the site.
@since 3.6.0
wp_login_form( $args = array() )
apply_filters( 'login_form_defaults', $defaults )
Filters the default login form output arguments.
@since 3.0.0
apply_filters( 'login_form_top', '', $args )
Filters content to display at the top of the login form.
@since 3.0.0
apply_filters( 'login_form_middle', '', $args )
Filters content to display in the middle of the login form.
@since 3.0.0
apply_filters( 'login_form_bottom', '', $args )
Filters content to display at the bottom of the login form.
@since 3.0.0
wp_lostpassword_url( $redirect = ” )
apply_filters( 'lostpassword_url', $lostpassword_url, $redirect )
Filters the Lost Password URL.
@since 2.8.0
wp_register( $before = ‘‘, $after = ‘ ‘, $echo = true )
apply_filters( 'register', $link )
Filters the HTML link to the Registration or Admin page.
@since 1.5.0
wp_meta()
do_action( 'wp_meta' )
Fires before displaying echoed content in the sidebar.
@since 1.5.0
do_action( 'get_sidebar', $name )
Fires before the sidebar template file is loaded.
@since 2.8.0
do_action( 'get_footer', $name )
Fires before the footer template file is loaded.
@since 2.8.0