Find term and term count Query error
-
I found 2 errors on the new plugin version. Please check cpt-onomies/cpt-onomy.php line 273 and line 283. It’s reading like:
implode( "','", $eligible_post_types, CPT_ONOMIES_POSTMETA_KEY, $taxonomy, $value)
instead of
implode( "','", $eligible_post_types), CPT_ONOMIES_POSTMETA_KEY, $taxonomy, $value
The implode function is passing 5 arguments instead of 2.
These the fix so you can add it to the new version
Line 273
$query = $wpdb->prepare( "SELECT (SELECT COUNT(*) FROM {$wpdb->postmeta} wpcountmeta INNER JOIN {$wpdb->posts} wpcountposts ON wpcountposts.ID = wpcountmeta.post_id AND wpcountposts.post_status = 'publish' AND wpcountposts.post_type IN (%s) WHERE wpcountmeta.meta_key = %s AND wpcountmeta.meta_value = wpposts.ID) AS count, wpposts.* FROM {$wpdb->posts} wpposts WHERE wpposts.post_type = %s AND wpposts.post_name = %s and wpposts.post_status = 'publish'", implode( "','", $eligible_post_types), CPT_ONOMIES_POSTMETA_KEY, $taxonomy, $value );
Line 283
$query = $wpdb->prepare( "SELECT (SELECT COUNT(*) FROM {$wpdb->postmeta} wpcountmeta INNER JOIN {$wpdb->posts} wpcountposts ON wpcountposts.ID = wpcountmeta.post_id AND wpcountposts.post_status = 'publish' AND wpcountposts.post_type IN (%s) WHERE wpcountmeta.meta_key = %s AND wpcountmeta.meta_value = wpposts.ID) AS count, wpposts.* FROM {$wpdb->posts} wpposts WHERE wpposts.post_type = %s AND wpposts.post_title = %s and wpposts.post_status = 'publish'", implode( "','", $eligible_post_types), CPT_ONOMIES_POSTMETA_KEY, $taxonomy, $value );
- The topic ‘Find term and term count Query error’ is closed to new replies.