Last active
November 18, 2015 19:18
-
-
Save mrbobbybryant/e2df502ee23eee66ed86 to your computer and use it in GitHub Desktop.
Allows you to update the taxonomy term order within the term_relationship table in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Update an objects term order in the term relationships table | |
| * @param int $term_order | |
| * @param int $object_id post_od | |
| * @param int $tt_id term_taxonomy_id | |
| * | |
| * @return int | |
| */ | |
| function set_taxonomy_term_term_order( $term_order, $object_id, $tt_id ) { | |
| global $wpdb; | |
| return $wpdb->query( $wpdb->prepare( | |
| " | |
| UPDATE $wpdb->term_relationships | |
| SET term_order = %d | |
| WHERE object_id = %d | |
| AND term_taxonomy_id = %d | |
| ", | |
| $term_order, | |
| $object_id, | |
| $tt_id | |
| ) ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment