Plugin Directory

Changeset 873260


Ignore:
Timestamp:
03/11/2014 07:45:56 AM (12 years ago)
Author:
Aurelien
Message:

Bug fix : http://wordpress.org/support/topic/updating-a-post-removes-it-from-the-custom-order

File:
1 edited

Legend:

Unmodified
Added
Removed
  • reorder-post-within-categories/trunk/reorder-posts-within-categories.php

    r846751 r873260  
    181181                 //echo "<li>".$taxonomie->name."</li>";
    182182                 $terms = get_terms( $taxonomie->name );
     183                 
     184                 $terms_of_the_post = wp_get_post_terms( $post_id, $taxonomie->name );
     185                 $term_ids_of_the_post = wp_list_pluck( $terms_of_the_post, 'term_id' );
    183186                 //echo "<pre>";
    184187                 //print_r($terms);
     
    187190                 //echo "<ul>";
    188191                 foreach ($terms as $term){
    189                      $terms_of_the_post = wp_get_post_terms( $post_id, $taxonomie->name );
     192                     //$terms_of_the_post = wp_get_post_terms( $post_id, $taxonomie->name );
    190193                     //echo "<li>";
    191194                    //echo "<p>--" . $term->name . " (" . $term->term_id .")</p>";
    192                     if(in_array($term, $terms_of_the_post))
     195                    //if(in_array($term, $terms_of_the_post))
     196                    if(in_array($term->term_id, $term_ids_of_the_post))
    193197                    {
    194198                        $trieEnCoursEnDb = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $table_name WHERE category_id=%d", $term->term_id) );
Note: See TracChangeset for help on using the changeset viewer.