wppaste
WordPress

wp_check_jsonp_callback( string $callback ): bool

Since
4.6.0
Source
wp-includes/functions.php:4650
Checks that a JSONP callback is a valid JavaScript callback name.

Description

Only allows alphanumeric characters and the dot character in callback function names. This helps to mitigate XSS attacks caused by directly outputting user input.

Parameters

$callbackstring
Supplied JSONP callback function name.

Return

bool
Whether the callback function name is valid.

Used by · 2

Source

function wp_check_jsonp_callback( $callback ) {	if ( ! is_string( $callback ) ) {		return false;	} 	preg_replace( '/[^\w\.]/', '', $callback, -1, $illegal_char_count ); 	return 0 === $illegal_char_count;}

History

Introduced in 4.6.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/functions.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.