[wp-trac] [WordPress Trac] #39129: get_the_terms seems to be broken after upgrading to version 4.7
WordPress Trac
noreply at wordpress.org
Thu Dec 8 20:39:43 UTC 2016
#39129: get_the_terms seems to be broken after upgrading to version 4.7
-------------------------------------+------------------------------
Reporter: kuphd1 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.7
Severity: normal | Resolution:
Keywords: reporter-feedback close | Focuses:
-------------------------------------+------------------------------
Comment (by kuphd1):
@boonebgorges... your solution definitely works. But it's not just the
"tr." that need to change. It's every instance of "tr" (without the ".")
in all the custom queries. So...
{{{#!php
<?php
$query = "SELECT tr.term_order FROM $wpdb->terms AS t INNER JOIN
$wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id LEFT JOIN
$wpdb->term_relationships AS tr ON tr.term_taxonomy_id =
tt.term_taxonomy_id WHERE t.term_id = %d AND tt.taxonomy = %s AND
tr.object_id = 0";
?>
}}}
becomes...
{{{#!php
<?php
$query = "SELECT tr2.term_order FROM $wpdb->terms AS t INNER JOIN
$wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id LEFT JOIN
$wpdb->term_relationships AS tr2 ON tr2.term_taxonomy_id =
tt.term_taxonomy_id WHERE t.term_id = %d AND tt.taxonomy = %s AND
tr2.object_id = 0";
?>
}}}
Thank you again. I never would've figured that out. :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39129#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list