wp_get_document_title(): string
- Since
- 4.4.0
- Source
wp-includes/general-template.php:1180
Compatibility
- WordPress
- since 4.4.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Return value
string- Tag with the document title.
Performance profile
How much work a call to wp_get_document_title() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Heavy
- Scaling
- Constant
- Instructions
- 8–110
- Plugin surface
- 4 hooks
- Called by
- 3
Reaches the database via get_post().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 194.
Third-party callbacks on 'pre_get_document_title', 'document_title_separator', 'document_title_parts' run inside this call, and their cost is not bounded by anything here.
3 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()called directly - optionoption read or write
get_option()one call below wp_get_document_title() - querycontent query
get_post()one call below wp_get_document_title()
Further down the call graph this can also reach cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 55 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_get_document_title() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!empty($title) | 8 | apply_filters() |
empty($title) && is_404() && !$paged && !$page | 56–57 | apply_filters(), is_404(), __(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && is_404() | 57–60 | apply_filters(), is_404(), __(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && is_front_page() && !$paged && !$page | 63–64 | apply_filters(), is_404(), is_search(), is_front_page(), get_bloginfo(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && is_front_page() | 64–67 | apply_filters(), is_404(), is_search(), is_front_page(), get_bloginfo(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && is_search() && !$paged && !$page | 65–66 | apply_filters(), is_404(), is_search(), __(), get_search_query(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && is_post_type_archive() && !$paged && !$page | 66–67 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), post_type_archive_title(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && is_search() | 66–69 | apply_filters(), is_404(), is_search(), __(), get_search_query(), sprintf(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) | 67–70 | apply_filters(), is_404(), __(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && is_post_type_archive() | 67–70 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), post_type_archive_title(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && is_tax() && !$paged && !$page | 69–70 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), single_term_title(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && is_tax() | 70–73 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), single_term_title(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
43 further outcomes, up to 110 instructions
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && is_home() && !$paged && !$page | 72–73 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), single_post_title(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && is_home() | 73–76 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), single_post_title(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && is_front_page() | 74–77 | apply_filters(), is_404(), is_search(), is_front_page(), get_bloginfo(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && is_singular() && !$paged && !$page | 75–76 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), single_post_title(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && is_search() | 76–79 | apply_filters(), is_404(), is_search(), __(), get_search_query(), sprintf(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && is_singular() | 76–79 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), single_post_title(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && is_post_type_archive() | 77–80 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), post_type_archive_title(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && is_category() && !$paged && !$page | 78–79 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), single_term_title(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && is_category() | 79–82 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), single_term_title(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && is_tax() | 80–83 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), single_term_title(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && is_tag() && !$paged && !$page | 81–82 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), single_term_title(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && is_tag() | 82–85 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), single_term_title(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && is_home() | 83–86 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), single_post_title(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && is_singular() | 86–89 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), single_post_title(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && !is_month() && !is_day() && !$paged && !$page | 86–87 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), is_day(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && get_queried_object() && !$paged && !$page | 87–88 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), get_queried_object(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && !is_month() && !is_day() | 87–90 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), is_day(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && get_queried_object() | 88–91 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), get_queried_object(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && is_category() | 89–92 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), single_term_title(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && !is_month() && !is_day() && !$paged && !$page | 89–90 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), is_day(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && is_year() && !$paged && !$page | 90–91 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), _x(), get_the_date(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && !is_month() && is_day() && !$paged && !$page | 90–91 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), is_day(), get_the_date(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && !is_month() && !is_day() | 90–93 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), is_day(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && is_year() | 91–94 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), _x(), get_the_date(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && !is_month() && is_day() | 91–94 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), is_day(), get_the_date(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && is_tag() | 92–95 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), single_term_title(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && is_month() && !$paged && !$page | 93–94 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), _x(), get_the_date(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && is_year() && !$paged && !$page | 93–94 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), _x(), get_the_date(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && !is_month() && is_day() && !$paged && !$page | 93–94 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), is_day(), get_the_date(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && is_month() | 94–97 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), _x(), get_the_date(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && is_year() | 94–97 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), _x(), get_the_date(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && !is_month() && is_day() | 94–97 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), is_day(), get_the_date(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && is_month() && !$paged && !$page | 96–97 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), _x(), get_the_date(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && !is_month() && !is_day() | 97–100 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), is_day(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && is_month() | 97–100 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), _x(), get_the_date(), is_404(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && get_queried_object() | 98–101 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), get_queried_object(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && !is_month() && !is_day() | 100–103 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), is_day(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && is_year() | 101–104 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), _x(), get_the_date(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && !is_month() && is_day() | 101–104 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), is_day(), get_the_date(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && !is_author() && !is_year() && is_month() | 104–107 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), is_year(), is_month(), _x(), get_the_date(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && is_year() | 104–107 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), _x(), get_the_date(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && !is_month() && is_day() | 104–107 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), is_day(), get_the_date(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
empty($title) && !is_404() && !is_search() && !is_front_page() && !is_post_type_archive() && !is_tax() && !is_home() && !is_singular() && !is_category() && !is_tag() && is_author() && !get_queried_object() && !is_year() && is_month() | 107–110 | apply_filters(), is_404(), is_search(), is_front_page(), is_post_type_archive(), is_tax(), is_home(), is_singular(), is_category(), is_tag(), is_author(), get_queried_object(), is_year(), is_month(), _x(), get_the_date(), is_404(), __(), sprintf(), is_front_page(), get_bloginfo(), apply_filters(), apply_filters(), array_filter(), apply_filters() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 194 | 8–110 | 19 | |
| 8.5 | 194 | 8–110 | 19 | |
| 8.4 | 194 | 8–110 | 19 | 6 fewer instructions than PHP 8.3 |
| 8.3 | 200 | 8–116 | 19 | |
| 8.2 | 200 | 8–116 | 19 | |
| 8.1 | 200 | 8–116 | 19 | |
| 7.4 | 200 | 8–116 | 19 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 4
4 hooks fire while wp_get_document_title() runs, in this order:
- apply_filters( pre_get_document_title )filterline 1192 (+12 into the body)
Filters the document title before it is generated.
- apply_filters( document_title_separator )filterline 1271 (+91 into the body)
Filters the separator for the document title.
- apply_filters( document_title_parts )filterline 1287 (+107 into the body)
Filters the parts of the document title.
Uses · 23
- apply_filters()Calls the callback functions that have been added to a filter hook.
- is_404()Determines whether the query has resulted in a 404 (returns no results).
- __()Retrieves the translation of $text.
- is_search()Determines whether the query is for a search.
- get_search_query()Retrieves the contents of the search WordPress query variable.
- is_front_page()Determines whether the query is for the front page of the site.
- get_bloginfo()Retrieves information about the current site.
- is_post_type_archive()Determines whether the query is for an existing post type archive page.
- post_type_archive_title()Displays or retrieves title for a post type archive.
- is_tax()Determines whether the query is for an existing custom taxonomy archive page.
- single_term_title()Displays or retrieves page title for taxonomy term archive.
- is_home()Determines whether the query is for the blog homepage.
Show all 23
- is_singular()Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types).
- single_post_title()Displays or retrieves page title for post.
- is_category()Determines whether the query is for an existing category archive page.
- is_tag()Determines whether the query is for an existing tag archive page.
- is_author()Determines whether the query is for an existing author archive page.
- get_queried_object()Retrieves the currently queried object.
- is_year()Determines whether the query is for an existing year archive.
- get_the_date()Retrieves the date of the post.
- _x()Retrieves translated string with gettext context.
- is_month()Determines whether the query is for an existing month archive.
- is_day()Determines whether the query is for an existing day archive.
Used by · 3
- _block_template_render_title_tag()Displays title tag with content, regardless of whether theme has title-tag support.
- _wp_render_title_tag()Displays title tag with content.
- get_wp_title_rss()Retrieves the blog title for the feed title.
Source code
function wp_get_document_title() { /** * Filters the document title before it is generated. * * Passing a non-empty value will short-circuit wp_get_document_title(), * returning that value instead. * * @since 4.4.0 * * @param string $title The document title. Default empty string. */ $title = apply_filters( 'pre_get_document_title', '' ); if ( ! empty( $title ) ) { return $title; } global $page, $paged; $title = array( 'title' => '', ); // If it's a 404 page, use a "Page not found" title. if ( is_404() ) { $title['title'] = __( 'Page not found' ); // If it's a search, use a dynamic search results title. } elseif ( is_search() ) { /* translators: %s: Search query. */ $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); // If on the front page, use the site title. } elseif ( is_front_page() ) { $title['title'] = get_bloginfo( 'name', 'display' ); // If on a post type archive, use the post type archive title. } elseif ( is_post_type_archive() ) { $title['title'] = post_type_archive_title( '', false ); // If on a taxonomy archive, use the term title. } elseif ( is_tax() ) { $title['title'] = single_term_title( '', false ); /* * If we're on the blog page that is not the homepage * or a single post of any post type, use the post title. */ } elseif ( is_home() || is_singular() ) { $title['title'] = single_post_title( '', false ); // If on a category or tag archive, use the term title. } elseif ( is_category() || is_tag() ) { $title['title'] = single_term_title( '', false ); // If on an author archive, use the author's display name. } elseif ( is_author() && get_queried_object() ) { $author = get_queried_object(); $title['title'] = $author->display_name; // If it's a date archive, use the date as the title. } elseif ( is_year() ) { $title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) ); } elseif ( is_month() ) { $title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); } elseif ( is_day() ) { $title['title'] = get_the_date(); } // Add a page number if necessary. if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { /* translators: %s: Page number. */ $title['page'] = sprintf( __( 'Page %s' ), max( $paged, $page ) ); } // Append the description or site title to give context. if ( is_front_page() ) { $title['tagline'] = get_bloginfo( 'description', 'display' );Changelog
Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/general-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.