post_type_helper = $post_type_helper; } /** * Whether the post exists. * * @param int $post_id The ID of the post. * * @return bool Whether the post exists. */ public function exists( int $post_id ): bool { return \get_post( $post_id ) !== null; } /** * Whether the post is of an indexable post type. * * @param int $post_id The ID of the post. * * @return bool Whether the post is of an indexable post type. */ public function is_supported_type( int $post_id ): bool { $post = \get_post( $post_id ); if ( $post === null ) { return false; } return $this->post_type_helper->is_of_indexable_post_type( $post->post_type ); } /** * Whether the current user is allowed to edit the post. * * @param int $post_id The ID of the post. * * @return bool Whether the current user is allowed to edit the post. */ public function can_edit( int $post_id ): bool { return \current_user_can( 'edit_post', $post_id ); } }