Inventory_Presser_Allow_Inventory_As_Home_Page::hide_page_from_edit_list( WP_Query $query )

Prevents the page this plugin creates from showing up in the list of pages while editing in the dashboard. We need a page to exist in order to allow users to choose it as their home page, but we don’t want them to see an actual page in the list, because the Inventory listing is not a page, it’s a custom post type archive.


Parameters Parameters

$query

(WP_Query) (Required) An instance of the WP_Query class.


Top ↑

Return Return

(void)


Top ↑

Source Source

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

	public function hide_page_from_edit_list( $query ) {
		$page_id = self::find_page_id();
		if ( -1 === $page_id ) {
			return;
		}
		global $pagenow, $post_type;
		if ( is_admin() && is_main_query() && 'edit.php' === $pagenow && 'page' === $post_type ) {
			$query->query_vars['post__not_in'] = array( $page_id );
		}
	}