W3cubDocs

/WordPress

Translations::add_entry( array|Translation_Entry $entry ): bool

Adds an entry to the PO structure.

Parameters

$entryarray|Translation_Entryrequired

Return

bool True on success, false if the entry doesn’t have a key.

Source

public function add_entry( $entry ) {
	if ( is_array( $entry ) ) {
		$entry = new Translation_Entry( $entry );
	}
	$key = $entry->key();
	if ( false === $key ) {
		return false;
	}
	$this->entries[ $key ] = &$entry;
	return true;
}

Changelog

Version Description
2.8.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/translations/add_entry