Permalink
Browse files

Added fix for the update bug.

  • Loading branch information...
1 parent f36e422 commit 9120df5edbbf92e4044f4427b8f47af5ab8b897c Faison Zutavern committed Mar 7, 2014
Showing with 5 additions and 3 deletions.
  1. +5 −3 reorder-posts-within-categories.php
@@ -180,16 +180,18 @@ public function savePost_callBack($post_id)
if($taxonomie->hierarchical == 1 && is_array($orderedSettingOptions) && in_array($taxonomie->name, $orderedSettingOptions)){
//echo "<li>".$taxonomie->name."</li>";
$terms = get_terms( $taxonomie->name );
+
+ $terms_of_the_post = wp_get_post_terms( $post_id, $taxonomie->name );
+ $term_ids_of_the_post = wp_list_pluck( $terms_of_the_post, 'term_id' );
//echo "<pre>";
//print_r($terms);
//echo "</pre>";
if (count($terms) > 0){
- //echo "<ul>";
+ //echo "<ul>";
foreach ($terms as $term){
- $terms_of_the_post = wp_get_post_terms( $post_id, $taxonomie->name );
//echo "<li>";
//echo "<p>--" . $term->name . " (" . $term->term_id .")</p>";
- if(in_array($term, $terms_of_the_post))
+ if(in_array($term->term_id, $term_ids_of_the_post))
{
$trieEnCoursEnDb = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $table_name WHERE category_id=%d", $term->term_id) );
if($trieEnCoursEnDb != 0)

0 comments on commit 9120df5

Please sign in to comment.