wp-includes/class-wp-error.php:110Retrieves all error messages, or the error messages for the given error code.
$codestring|intoptional''string[] public function get_error_messages( $code = '' ) { // Return all messages if no code specified. if ( empty( $code ) ) { $all_messages = array(); foreach ( (array) $this->errors as $messages ) { $all_messages = array_merge( $all_messages, $messages ); } return $all_messages; } return $this->errors[ $code ] ?? array(); }Introduced in 2.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/class-wp-error.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.