wp_sprintf
Filters a fragment from the pattern passed to wp_sprintf().
If the fragment is unchanged, then sprintf() will be run on the fragment.
Usage
add_filter( 'wp_sprintf', 'wp_kama_sprintf_filter', 10, 2 ); /** * Function for `wp_sprintf` filter-hook. * * @param string $fragment A fragment from the pattern. * @param string $arg The argument. * * @return string */ function wp_kama_sprintf_filter( $fragment, $arg ){ // filter... return $fragment; }
- $fragment(string)
- A fragment from the pattern.
- $arg(string)
- The argument.
Changelog
Since 2.5.0 | Introduced. |
Where the hook is called
wp_sprintf
wp-includes/formatting.php 5268
$_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
Where the hook is used in WordPress
wp-includes/default-filters.php 229
add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 );