wp_get_extension_error_description() WordPress Function

The wp_get_extension_error_description() function is used to get the error message associated with a failed extension installation.

wp_get_extension_error_description( array $error ) #

Get a human readable description of an extension’s error.


Parameters

$error

(array)(Required)Error details from error_get_last().


Top ↑

Return

(string) Formatted error description.


Top ↑

Source

File: wp-includes/error-protection.php

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function wp_get_extension_error_description( $error ) {
    $constants   = get_defined_constants( true );
    $constants   = isset( $constants['Core'] ) ? $constants['Core'] : $constants['internal'];
    $core_errors = array();
 
    foreach ( $constants as $constant => $value ) {
        if ( 0 === strpos( $constant, 'E_' ) ) {
            $core_errors[ $value ] = $constant;
        }
    }
 
    if ( isset( $core_errors[ $error['type'] ] ) ) {
        $error['type'] = $core_errors[ $error['type'] ];
    }
 
    /* translators: 1: Error type, 2: Error line number, 3: Error file name, 4: Error message. */
    $error_message = __( 'An error of type %1$s was caused in line %2$s of the file %3$s. Error message: %4$s' );
 
    return sprintf(
        $error_message,
        "<code>{$error['type']}</code>",
        "<code>{$error['line']}</code>",
        "<code>{$error['file']}</code>",
        "<code>{$error['message']}</code>"
    );
}


Top ↑

Changelog

Changelog
VersionDescription
5.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.