wp-includes/functions.php:6194Generates a user-level error/warning/notice/deprecation message.
$function_namestring$messagestring$error_levelintoptionalE_USER_NOTICE3 hooks fire while wp_trigger_error() runs, in this order:
Always fires when the given function triggers a user-level error/warning/notice/deprecation message.
Filters whether to trigger an error.
Fires when the given function triggers a user-level error/warning/notice/deprecation message.
function wp_trigger_error( $function_name, $message, $error_level = E_USER_NOTICE ) { /** * Always fires when the given function triggers a user-level error/warning/notice/deprecation message. * * Can be used to attach custom error handlers even if WP_DEBUG is not truthy. * * @since 7.0.0 * * @param string $function_name The function that triggered the error. * @param string $message The message explaining the error. * @param int $error_level The designated error type for this error. */ do_action( 'wp_trigger_error_always_run', $function_name, $message, $error_level ); /** * Filters whether to trigger an error. * * @since 7.0.0 * * @param bool $trigger Whether to trigger the error. Default true. * @param string $function_name The function that triggered the error. * @param string $message The message explaining the error. * @param int $error_level The designated error type for this error. */ if ( ! apply_filters( 'wp_trigger_error_trigger_error', true, $function_name, $message, $error_level ) ) { return; } // Bail out if WP_DEBUG is not turned on. if ( ! WP_DEBUG ) { return; } /** * Fires when the given function triggers a user-level error/warning/notice/deprecation message. * * Can be used for debug backtracking. * * @since 6.4.0 * * @param string $function_name The function that triggered the error. * @param string $message The message explaining the error. * @param int $error_level The designated error type for this error. */ do_action( 'wp_trigger_error_run', $function_name, $message, $error_level ); if ( ! empty( $function_name ) ) { $message = sprintf( '%s(): %s', $function_name, $message ); } $message = wp_kses( $message, array( 'a' => array( 'href' => true ), 'br' => array(), 'code' => array(), 'em' => array(), 'strong' => array(), ), array( 'http', 'https' ) ); if ( E_USER_ERROR === $error_level ) { throw new WP_Exception( $message ); } trigger_error( $message, $error_level );}Introduced in 6.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.