wpseo_extract_id_pattern
Filter wpseo_extract_id_pattern Allows filtering the regex patern to be used to extract image IDs from class/attribute names.
Defaults to the pattern that extracts image IDs from core's wp-image-<ID> native format in image classes.
Использование
add_filter( 'wpseo_extract_id_pattern', 'wp_kama_wpseo_extract_id_pattern_filter' );
/**
* Function for `wpseo_extract_id_pattern` filter-hook.
*
* @param string $string The regex pattern to be used to extract image IDs from class names. Empty string if the whole class/attribute should be returned.
*
* @return string
*/
function wp_kama_wpseo_extract_id_pattern_filter( $string ){
// filter...
return $string;
}
- $string(строка)
- The regex pattern to be used to extract image IDs from class names. Empty string if the whole class/attribute should be returned.
Где вызывается хук
wpseo_extract_id_pattern
yoast/src/images/Application/image-content-extractor.php 162
$pattern = \apply_filters( 'wpseo_extract_id_pattern', '/(?<!\S)wp-image-(\d+)(?!\S)/i' );