wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_trigger_error › WordPress Function
Since6.4.0
Deprecatedn/a
› wp_trigger_error ( $function_name, $message, $error_level = E_USER_NOTICE )
Parameters: (3) |
|
Defined at: |
|
Codex: |
Generates a user-level error/warning/notice/deprecation message.
Generates the message whenWP_DEBUG
is true.Related Functions: wp_image_editor, wp_get_theme_error, wp_generator, wp_get_plugin_error, wp_trim_words
Source
function wp_trigger_error( $function_name, $message, $error_level = E_USER_NOTICE ) { // 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 was called. * @param string $message A message explaining what has been done incorrectly. * @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 ); }