Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter 46n2

    (@46n2)

    Ahh it looks like you are right. Sorry for the confusion.

    Thread Starter 46n2

    (@46n2)

    Based on the current version of your plugin it looks like I have confused it with one having a similar name. I’ll reach out to their support instead.

    After some digging, I believe I found a solution to this problem.

    ElasticPress uses WP_Query to fetch posts for indexing. When building the query, WP_Query compares the post_status argument against the results of the get_post_stati() WordPress function, which returns an array of registered post stati (statuses).

    WooCommerce does this, but it does not appear to happen in time when running elasticpress index from the wp-cli. My solution was to hook the ep_wp_cli_pre_index action and call the WooCommerce registration function manually. Using the solution below, my site is currently indexing WooCommerce orders.

    add_action( ‘ep_wp_cli_pre_index’, function( $args, $assoc_args ) {
    require_once(ABSPATH . ‘wp-content/plugins/woocommerce/includes/class-wc-post-types.php’);
    WC_Post_types::register_post_status();
    }, 10, 1 );

Viewing 3 replies - 1 through 3 (of 3 total)