wpdb::get_charset_collate() WordPress Method

The wpdb::get_charset_collate() WordPress method is used to return the character set and collation for the WordPress database. This method is useful for creating custom tables or for running queries that require a specific character set and collation.

wpdb::get_charset_collate() #

Retrieves the database character collate.


Return

(string) The database character collate.


Top ↑

Source

File: wp-includes/wp-db.php

	public function get_charset_collate() {
		$charset_collate = '';

		if ( ! empty( $this->charset ) ) {
			$charset_collate = "DEFAULT CHARACTER SET $this->charset";
		}
		if ( ! empty( $this->collate ) ) {
			$charset_collate .= " COLLATE $this->collate";
		}

		return $charset_collate;
	}


Top ↑

Changelog

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