render_block_core_media_text( array $attributes, string $content ): string
- Since
- 6.6.0
- Source
wp-includes/blocks/media-text.php:18
core/media-text block on server.Compatibility
- WordPress
- since 6.6.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.
Parameters
$attributesarray- The block attributes.
$contentstring- The block rendered content.
Return value
string- Returns the Media & Text block markup, if useFeaturedImage is true.
Performance profile
How much work a call to render_block_core_media_text() 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
- Scales with input
- Instructions
- 6–155
- Plugin surface
- None
- Called by
- 0
Reaches the database via get_post().
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 176.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters()one call below render_block_core_media_text() - querycontent query
get_post()one call below render_block_core_media_text()
Further down the call graph this can also reach cache, serialize, option 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 · 67 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost render_block_core_media_text() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 6 | none |
!in_the_loop() | 13 | in_the_loop(), get_the_post_thumbnail_url() |
in_the_loop() | 15 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url() |
!in_the_loop() && !isset($attributes) && !->next_tag() && !figure() | 74–77 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure() |
in_the_loop() && !isset($attributes) && !->next_tag() && !figure() | 76–79 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure() |
!in_the_loop() && !isset($attributes) && !figure() | 78–81 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure() |
!in_the_loop() && !isset($attributes) && !->next_tag() && !->has_bookmark() && !figure() | 79–82 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure() |
in_the_loop() && !isset($attributes) && !figure() | 80–83 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure() |
!in_the_loop() && !isset($attributes) && !->next_tag() && figure() | 81–84 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
in_the_loop() && !isset($attributes) && !->next_tag() && !->has_bookmark() && !figure() | 81–84 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure() |
in_the_loop() && !isset($attributes) && !->next_tag() && figure() | 83–86 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
!in_the_loop() && !isset($attributes) && figure() | 85–88 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
55 further outcomes, up to 155 instructions
!in_the_loop() && !isset($attributes) && !->next_tag() && !->has_bookmark() && figure() | 86–89 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
!in_the_loop() && !isset($attributes) && !->next_tag() && ->has_bookmark() && !figure() | 87–90 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure() |
in_the_loop() && !isset($attributes) && figure() | 87–90 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
in_the_loop() && !isset($attributes) && !->next_tag() && !->has_bookmark() && figure() | 88–91 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
!in_the_loop() && isset($attributes) && !->next_tag() && !figure() | 89–92 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure() |
in_the_loop() && !isset($attributes) && !->next_tag() && ->has_bookmark() && !figure() | 89–92 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure() |
in_the_loop() && isset($attributes) && !->next_tag() && !figure() | 91–94 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure() |
!in_the_loop() && isset($attributes) && !figure() | 93–96 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure() |
!in_the_loop() && isset($attributes) && !->next_tag() && !->has_bookmark() && !figure() | 94–97 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure() |
!in_the_loop() && !isset($attributes) && !->next_tag() && ->has_bookmark() && figure() | 94–97 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
in_the_loop() && isset($attributes) && !figure() | 95–98 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure() |
!in_the_loop() && isset($attributes) && !->next_tag() && figure() | 96–99 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
in_the_loop() && isset($attributes) && !->next_tag() && !->has_bookmark() && !figure() | 96–99 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure() |
in_the_loop() && !isset($attributes) && !->next_tag() && ->has_bookmark() && figure() | 96–99 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
in_the_loop() && isset($attributes) && !->next_tag() && figure() | 98–101 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
!in_the_loop() && isset($attributes) && figure() | 100–103 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
!in_the_loop() && isset($attributes) && !->next_tag() && !->has_bookmark() && figure() | 101–104 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
!in_the_loop() && isset($attributes) && !->next_tag() && ->has_bookmark() && !figure() | 102–105 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure() |
in_the_loop() && isset($attributes) && figure() | 102–105 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
in_the_loop() && isset($attributes) && !->next_tag() && !->has_bookmark() && figure() | 103–106 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
in_the_loop() && isset($attributes) && !->next_tag() && ->has_bookmark() && !figure() | 104–107 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure() |
!in_the_loop() && isset($attributes) && !->next_tag() && ->has_bookmark() && figure() | 109–112 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
in_the_loop() && isset($attributes) && !->next_tag() && ->has_bookmark() && figure() | 111–114 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag() |
!in_the_loop() && !isset($attributes) && figure() | 116–119 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && !isset($attributes) && figure() | 118–121 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && !isset($attributes) && figure() | 120–123 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && !isset($attributes) && !->has_bookmark() && figure() | 121–124 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && !isset($attributes) && figure() | 122–125 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && !isset($attributes) && figure() | 122–125 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && !isset($attributes) && !->has_bookmark() && figure() | 123–126 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && !isset($attributes) && figure() | 124–127 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && !isset($attributes) && figure() | 126–129 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && !isset($attributes) && !->has_bookmark() && figure() | 127–130 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && !isset($attributes) && figure() | 128–131 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && !isset($attributes) && ->has_bookmark() && figure() | 129–132 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && !isset($attributes) && !->has_bookmark() && figure() | 129–132 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && isset($attributes) && figure() | 131–134 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && !isset($attributes) && ->has_bookmark() && figure() | 131–134 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && isset($attributes) && figure() | 133–136 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && isset($attributes) && figure() | 135–138 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && !isset($attributes) && ->has_bookmark() && figure() | 135–138 | in_the_loop(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && isset($attributes) && !->has_bookmark() && figure() | 136–139 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && isset($attributes) && figure() | 137–140 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && isset($attributes) && figure() | 137–140 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && !isset($attributes) && ->has_bookmark() && figure() | 137–140 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && isset($attributes) && !->has_bookmark() && figure() | 138–141 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && isset($attributes) && figure() | 139–142 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && isset($attributes) && figure() | 141–144 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && isset($attributes) && !->has_bookmark() && figure() | 142–145 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && isset($attributes) && figure() | 143–146 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && isset($attributes) && ->has_bookmark() && figure() | 144–147 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && isset($attributes) && !->has_bookmark() && figure() | 144–147 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && isset($attributes) && ->has_bookmark() && figure() | 146–149 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->get_updated_html() |
!in_the_loop() && isset($attributes) && ->has_bookmark() && figure() | 150–153 | in_the_loop(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
in_the_loop() && isset($attributes) && ->has_bookmark() && figure() | 152–155 | in_the_loop(), update_post_thumbnail_cache(), get_the_post_thumbnail_url(), round(), round(), wp_unique_id(), ->next_tag(), ->get_updated_html(), ->next_tag(), ->has_bookmark(), ->seek(), ->set_attribute(), ->get_updated_html(), preg_quote(), figure(), ->remove_attribute(), ->next_tag(), esc_url(), ->set_attribute(), get_post_thumbnail_id(), ->set_attribute(), get_post_thumbnail_id(), get_post_meta(), strip_tags(), ->set_attribute(), ->set_attribute(), ->get_updated_html() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 176 | 6–155 | 16 | |
| 8.5 | 176 | 6–155 | 16 | |
| 8.4 | 176 | 6–155 | 16 | 5 fewer instructions than PHP 8.3 |
| 8.3 | 181 | 6–160 | 16 | |
| 8.2 | 181 | 6–160 | 16 | 1 more instruction than PHP 8.1 |
| 8.1 | 180 | 6–162 | 16 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 181 | 6–163 | 16 |
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.
Uses · 8
- in_the_loop()Determines whether the caller is in the Loop.
- update_post_thumbnail_cache()Updates cache for thumbnails in the current loop.
- get_the_post_thumbnail_url()Returns the post thumbnail URL.
- wp_unique_id()Gets unique ID.
- esc_url()Checks and cleans a URL.
- get_post_thumbnail_id()Retrieves the post thumbnail ID.
- get_post_meta()Retrieves a post meta field for the given post ID.
- WP_HTML_Tag_Processor::__construct()Constructor.
Source code
function render_block_core_media_text( $attributes, $content ) { if ( false === $attributes['useFeaturedImage'] ) { return $content; } if ( in_the_loop() ) { update_post_thumbnail_cache(); } $current_featured_image = get_the_post_thumbnail_url(); if ( ! $current_featured_image ) { return $content; } $has_media_on_right = 'right' === ( $attributes['mediaPosition'] ?? null ); $image_fill = (bool) ( $attributes['imageFill'] ?? false ); $focal_point = isset( $attributes['focalPoint'] ) ? round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%' : '50% 50%'; $unique_id = 'wp-block-media-text__media-' . wp_unique_id(); $block_tag_processor = new WP_HTML_Tag_Processor( $content ); $block_query = array( 'tag_name' => 'div', 'class_name' => 'wp-block-media-text', ); while ( $block_tag_processor->next_tag( $block_query ) ) { if ( $image_fill ) { // The markup below does not work with the deprecated `is-image-fill` class. $block_tag_processor->remove_class( 'is-image-fill' ); $block_tag_processor->add_class( 'is-image-fill-element' ); } } $content = $block_tag_processor->get_updated_html(); $media_tag_processor = new WP_HTML_Tag_Processor( $content ); $wrapping_figure_query = array( 'tag_name' => 'figure', 'class_name' => 'wp-block-media-text__media', ); if ( $has_media_on_right ) { // Loop through all the figure tags and set a bookmark on the last figure tag. while ( $media_tag_processor->next_tag( $wrapping_figure_query ) ) { $media_tag_processor->set_bookmark( 'last_figure' ); } if ( $media_tag_processor->has_bookmark( 'last_figure' ) ) { $media_tag_processor->seek( 'last_figure' ); // Insert a unique ID to identify the figure tag. $media_tag_processor->set_attribute( 'id', $unique_id ); } } else { if ( $media_tag_processor->next_tag( $wrapping_figure_query ) ) { // Insert a unique ID to identify the figure tag. $media_tag_processor->set_attribute( 'id', $unique_id ); } } $content = $media_tag_processor->get_updated_html(); // Add the image tag inside the figure tag, and update the image attributes // in order to display the featured image. $media_size_slug = $attributes['mediaSizeSlug'] ?? 'full'; $image_tag = '<img class="wp-block-media-text__featured_image">'; $content = preg_replace( '/(<figure\s+id="' . preg_quote( $unique_id, '/' ) . '"\s+class="wp-block-media-text__media"\s*>)/', '$1' . $image_tag, $content ); $image_tag_processor = new WP_HTML_Tag_Processor( $content ); if ( $image_tag_processor->next_tag( array( 'tag_name' => 'figure', 'id' => $unique_id, ) ) ) { // The ID is only used to ensure that the correct figure tag is selected, // and can now be removed. $image_tag_processor->remove_attribute( 'id' );Changelog
Introduced in 6.6.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.1.0 tag, from
src/wp-includes/blocks/media-text.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.