File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 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 ' );
You can’t perform that action at this time.
0 commit comments