• Hey, I get this error when I try to filter the instances of my Custom Post Type “Learning Card” by a specific CPTonomy “Competence” :

    Warning: implode() expects at most 2 parameters, 5 given in \wordpress\wp-content\plugins\cpt-onomies\cpt-onomy.php on line 273

    Can anybody help me?

    Further, I tried to count the assignments of specific CPTonomies and show them as a column in the listing of my “Competence” Instances. Any tips would be great.

    I am new to wordpress and hope you can understand my problems….

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

    (@sira162)

    I solved my first problem: you just need to reorder the arguments so that, the implode function takes 2 arguments

    How did you do this?

    Thread Starter sira162

    (@sira162)

    Hi Andy,

    I changed the code from line 273 in cpt-onomy.php to:

    $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 );
    
    • This reply was modified 6 years, 8 months ago by sira162.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘filter CPT by specific CPTonomy’ is closed to new replies.