PO::export_to_file() WordPress Method

The PO::export_to_file() Wordpress method allows you to export a PO file to a given file path.

PO::export_to_file( string $filename, bool $include_headers = true ) #

Same as {@link export}, but writes the result to a file


Parameters

$filename

(string)(Required)Where to write the PO string.

$include_headers

(bool)(Optional)Whether to include the headers in the export.

Default value: true


Top ↑

Return

(bool) true on success, false on error


Top ↑

Source

File: wp-includes/pomo/po.php

		public function export_to_file( $filename, $include_headers = true ) {
			$fh = fopen( $filename, 'w' );
			if ( false === $fh ) {
				return false;
			}
			$export = $this->export( $include_headers );
			$res    = fwrite( $fh, $export );
			if ( false === $res ) {
				return false;
			}
			return fclose( $fh );
		}

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.