wpdb::suppress_errors() WordPress Method

The wpdb::suppress_errors() method is a Boolean flag that, when set to true, prevents the display of database errors. This is useful for debugging purposes, as it prevents the display of database error messages that might give away sensitive information. Note that this does not prevent the actual database errors from happening, it just prevents them from being displayed.

wpdb::suppress_errors( bool $suppress = true ) #

Enables or disables suppressing of database errors.


Description

By default database errors are suppressed.

Top ↑

See also


Top ↑

Parameters

$suppress

(bool)(Optional) Whether to suppress errors.

Default value: true


Top ↑

Return

(bool) Whether suppressing of errors was previously active.


Top ↑

Source

File: wp-includes/wp-db.php

	public function suppress_errors( $suppress = true ) {
		$errors                = $this->suppress_errors;
		$this->suppress_errors = (bool) $suppress;
		return $errors;
	}


Top ↑

Changelog

Changelog
VersionDescription
2.5.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.