block_core_navigation_link_build_css_font_sizes( array $context ): array
- Since
- 5.9.0
- Source
wp-includes/blocks/navigation-link.php:96
Description
This function is no longer used internally and is kept only for backward compatibility with third-party code that may call it directly.
Compatibility
Deprecated in WordPress 7.0.0. Kept for back-compatibility; avoid it in new code.
- WordPress
- since 5.9.0
- PHP
- 7.4–8.6-dev
- 6.7.10
- 6.8.11
- 6.9.10
- 7.0.7
- 7.1.3
Present in every tracked release (6.7.10 to 7.1.3), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$contextarray- Navigation block context.
Return value
array- Font size CSS classes and inline styles.
Performance profile
How much work a call to block_core_navigation_link_build_css_font_sizes() 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
- Trivial
- Scaling
- Constant
- Instructions
- 13–25
- Plugin surface
- None
- Called by
- 0
Touches nothing outside its own arguments.
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 33.
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
do_action()one call below block_core_navigation_link_build_css_font_sizes()
Further down the call graph this can also reach cache, query, option, 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 · 2 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost block_core_navigation_link_build_css_font_sizes() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 13–19 | _deprecated_function() |
!$context && isset($value) | 25 | _deprecated_function(), size() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 33 | 13–25 | 2 | |
| 8.5 | 33 | 13–25 | 2 | |
| 8.4 | 33 | 13–25 | 2 | 2 fewer instructions than PHP 8.3 |
| 8.3 | 35 | 13–26 | 2 | |
| 8.2 | 35 | 13–26 | 2 | |
| 8.1 | 35 | 13–26 | 2 | |
| 7.4 | 35 | 13–26 | 2 |
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 · 2
- _deprecated_function()Marks a function as deprecated and inform when it has been used.
- wp_get_typography_font_size_value()Returns a font-size value based on a given font-size preset.
Source code
function block_core_navigation_link_build_css_font_sizes( $context ) { _deprecated_function( __FUNCTION__, '7.0.0' ); // CSS classes. $font_sizes = array( 'css_classes' => array(), 'inline_styles' => '', ); $has_named_font_size = array_key_exists( 'fontSize', $context ); $has_custom_font_size = isset( $context['style']['typography']['fontSize'] ); if ( $has_named_font_size ) { // Add the font size class. $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); } elseif ( $has_custom_font_size ) { // Add the custom font size inline style. $font_sizes['inline_styles'] = sprintf( 'font-size: %s;', wp_get_typography_font_size_value( array( 'size' => $context['style']['typography']['fontSize'], ) ) ); } return $font_sizes;}Changelog
Introduced in 5.9.0. Unchanged from 6.7.10 through 7.1.3.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.3 tag, from
src/wp-includes/blocks/navigation-link.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.