Viewing 5 reply threads
  • Author
    Posts
    • #6878
      cyclissmo
      Member

      Hi there,

      Just wanted to share an issue that I resolved which turned out to be a conflict with a Piklist filter.

      I have a get_terms defined in my plugin code similar to the following. While troubleshooting, get_terms with any kind of meta_query parameters would trigger a database error. It should be noted that this code worked prior to the 9.9.9 update.

      $terms = get_terms( array(
      	'taxonomy' => 'my_taxonomy',
      	'hide_empty' => false,
      	'meta_query' => array(
      		'relation' => 'OR',	
      		array(
      			'key' => 'my_term_meta',
      			'compare' => 'NOT EXISTS',
      		),
      		array(
      			'key' => 'my_term_meta',
      			'value' => '1',
      			'compare' => '!=',
      		)
      	)
      ));

      And the error:

      WordPress database error: [Not unique table/alias: ‘wp_termmeta’]

      I traced the culprit to class-piklist-taxonomy.php ‘terms_clauses’ filter. I removed the filter right before executing get_terms and the error went away.

      From cursory observation, it looks like the Piklist filter may not have been adding table aliases.

      Hope this info is useful.
      Mike

    • #6888
      Steve
      Keymaster

      Thanks! We’ll take a look.

    • #8410
      hughc
      Member

      @sbruner I’ve just struck the same issue, it breaks term_meta database queries made by Restrict Content Pro, which occur pretty much on every page load.

      Reading the source, I can’t determine what the filter does… can you shed some light, and what disabling it will disable, within Piklist?

      in an init handler, I’m using
      remove_filter('terms_clauses', array('piklist_taxonomy', 'terms_clauses'), 10); to unhook it.

    • #8757
      sreen
      Member

      @Steve,

      We have same issue for “term meta query” using from my custom plugin. After that, I’ve seen this thread and applied the above mentioned remove_filter hook. Could you please suggest us, Can we use this same remove filter hook? (or) Is there any specific Piklist version release available to resolved the get terms issue?

      Thanks,
      Seeni

    • #8761
      Steve
      Keymaster

      What version of WordPress are you running?

    • #8767
      sreen
      Member

      Thanks for your reply. We are using WP version #4.7.8

Viewing 5 reply threads
  • You must be logged in to reply to this topic.