Tagged: get terms Issue
- This topic has 5 replies, 4 voices, and was last updated 3 years, 11 months ago by
sreen.
-
AuthorPosts
-
-
July 4, 2016 at 3:31 pm #6878
cyclissmoMemberHi 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_termsdefined in my plugin code similar to the following. While troubleshooting,get_termswith any kind ofmeta_queryparameters 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_termsand 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 -
July 5, 2016 at 11:05 am #6888
SteveKeymasterThanks! We’ll take a look.
-
October 10, 2017 at 8:53 pm #8410
hughcMember@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. -
February 27, 2018 at 8:24 am #8757
sreenMember@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 -
February 27, 2018 at 11:53 am #8761
SteveKeymasterWhat version of WordPress are you running?
-
February 28, 2018 at 7:45 am #8767
sreenMemberThanks for your reply. We are using WP version #4.7.8
-
-
AuthorPosts
- You must be logged in to reply to this topic.