A bug in front end search functionality?
-
We love your plugin!
I was trying today to get the font end search working for the EAN-14 numbers we’re entering into the back end.
I ticked the “Search (This will enable searching by EAN on frontend.)” checkbox of course but that didn’t work so I had a look under the bonnet.
I noticed in “ean-for-woocommerce/includes/class-alg-wc-ean-search.php” line 226 – 233 this code..
// Pre-check if ( ! isset( $wp_query->query['s'] ) || ! isset( $wp_query->query['post_type'] ) || 'product' != $wp_query->query['post_type'] || ! apply_filters( 'alg_wc_ean_search', true, $wp_query ) ) { return; }But “$wp_query->query[‘post_type’]” returns an array, not the post type itself. When I change the code, adding a “[0]” to the end of “$wp_query->query[‘post_type’]”, like this..
if ( ! isset( $wp_query->query['s'] ) || ! isset( $wp_query->query['post_type'] ) || 'product' != $wp_query->query['post_type'][0] || ! apply_filters( 'alg_wc_ean_search', true, $wp_query ) ) { return; }The front end search starts working perfectly.
Did I find a bug or am just mis-configuring the plugin or tripping or something?
The topic ‘A bug in front end search functionality?’ is closed to new replies.