WP_Importer::get_page() WordPress Method

The WP_Importer::get_page() method is used to get information about a page from a WordPress export file. This method can be used to get information about a page by its ID, title, or slug.

WP_Importer::get_page( string $url, string $username = '', string $password = '', bool $head = false ) #

GET URL


Parameters

$url

(string)(Required)

$username

(string)(Optional)

Default value: ''

$password

(string)(Optional)

Default value: ''

$head

(bool)(Optional)

Default value: false


Top ↑

Return

(array)


Top ↑

Source

File: wp-admin/includes/class-wp-importer.php

	public function get_page( $url, $username = '', $password = '', $head = false ) {
		// Increase the timeout.
		add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );

		$headers = array();
		$args    = array();
		if ( true === $head ) {
			$args['method'] = 'HEAD';
		}
		if ( ! empty( $username ) && ! empty( $password ) ) {
			$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
		}

		$args['headers'] = $headers;

		return wp_safe_remote_request( $url, $args );
	}

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.