Skip to content

Commit 70c1587

Browse files
committed
Specify post type to index
1 parent 48bede2 commit 70c1587

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

facetwp-wp-cli.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/*
33
* Plugin Name: FacetWP index via WP-CLI
4-
* Version: 1.0
4+
* Version: 1.1
55
* Description: Run indexing of FacetWP via WP-CLI
66
* Author: Level Level
77
* Author URI: http://www.level-level.com
@@ -42,14 +42,20 @@ function index( $args, $assoc_args ) {
4242

4343
error_reporting(0);
4444

45+
$post_type = 'any';
46+
47+
if ( isset( $args[0] ) ) {
48+
$post_type = $args[0];
49+
}
50+
4551
$posts_per_page = 100;
4652
$page = 1;
4753

4854
do {
4955
$post_ids = get_posts( array(
50-
'posts_per_page' => $posts_per_page,
51-
'paged' => $page,
52-
'post_type' => 'any',
56+
'posts_per_page' => $posts_per_page,
57+
'paged' => $page,
58+
'post_type' => $post_type,
5359
'post_status' => 'publish',
5460
'fields' => 'ids',
5561
'orderby' => 'ID',
@@ -97,4 +103,4 @@ protected function stop_the_insanity() {
97103
}
98104

99105

100-
WP_CLI::add_command( 'facet', __NAMESPACE__ . '\\CLI' );
106+
WP_CLI::add_command( 'facet', __NAMESPACE__ . '\\CLI' );

0 commit comments

Comments
 (0)