Required_Page::get_post_candidates( bool $include_uninstalled = false )
Summary
Find all the posts that meet the criteria (e.g., post type, content) to become this required page.
Parameters
- $include_uninstalled
-
(bool) (Optional) Whether the list of candidates should include pages that have been uninstalled and set to draft
Default value: false
Return
(int[]) Post IDs of potential posts
Source
File: src/BigCommerce/Pages/Required_Page.php
public function get_post_candidates( $include_uninstalled = false ) { /** @var \wpdb $wpdb */ global $wpdb; $content = $this->get_content(); $content_like = '%' . $wpdb->esc_like( $content ) . '%'; $status = "post_status='publish'"; if ( $include_uninstalled ) { $status = "( $status OR ( post_status='draft' AND post_name LIKE '%-uninstalled' ) )"; } $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type=%s AND $status AND post_content LIKE %s", $this->get_post_type(), $content_like ) ); $post_ids = array_map( 'intval', $post_ids ); /** * This filter is documented in src/BigCommerce/Pages/Shipping_Returns_Page.php. */ $post_ids = (array) apply_filters( 'bigcommerce/pages/matching_page_candidates', $post_ids, static::NAME ); return $post_ids; }