wp-includes/blocks/gallery.php:64Returns the column gap value used for Gallery image width calculations.
$gapstring|array|null$fallback_gapstringstringfunction block_core_gallery_get_column_gap_value( $gap, $fallback_gap ) { if ( is_array( $gap ) ) { $gap = $gap['left'] ?? $fallback_gap; } // Make sure $gap is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null. $gap = is_string( $gap ) ? $gap : ''; // Skip if gap value contains unsupported characters. // Regex for CSS value borrowed from `safecss_filter_attr`, and used here // because we only want to match against the value, not the CSS attribute. $gap = $gap && preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap; // Get spacing CSS variable from preset value if provided. if ( is_string( $gap ) && str_contains( $gap, 'var:preset|spacing|' ) ) { $index_to_splice = strrpos( $gap, '|' ) + 1; $slug = _wp_to_kebab_case( substr( $gap, $index_to_splice ) ); $gap = "var(--wp--preset--spacing--$slug)"; } $gap_column = ( null !== $gap && '' !== $gap ) ? $gap : $fallback_gap; // The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`. return '0' === $gap_column ? '0px' : $gap_column;}Introduced in 7.1.0.
Signature, return type and hooks compared across 1 parsed release.
src/wp-includes/blocks/gallery.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.