Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Inventory_Presser_Allow_Inventory_As_Home_Page::create_page()

create_page

Description Description

Creates a page so something shows up in the setting dropdown


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-allow-inventory-as-home-page.php

	private static function create_page() {
		// Does the page already exist?
		if ( -1 != self::find_page_id() ) {
			// Yes, abort
			return;
		}

		$id = wp_insert_post(
			array(
				'comment_status' => 'closed',
				'meta_input'     => array(
					self::PAGE_META_KEY => '1',
				),
				'post_content'   => __( 'This is not the real Inventory page. This page exists so that you can set the site\'s home page to the Inventory list in the Customizer or the Settings > Reading admin page. The Inventory "page" is actually a custom post type archive, and typically will not show up in those settings drop downs. All requests for this page will be redirected to the Inventory archive.', 'inventory-presser' ),
				'post_status'    => 'publish',
				'post_title'     => __( 'Inventory', 'inventory-presser' ),
				'post_type'      => 'page',
			)
		);
	}