Plugin Directory

Changeset 1190423


Ignore:
Timestamp:
06/30/2015 05:29:06 PM (11 years ago)
Author:
Devtard
Message:

Bux fix

Location:
automatic-post-tagger
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • automatic-post-tagger/tags/1.8.1/automatic-post-tagger.php

    r1176395 r1190423  
    32183218    ### ADDING TERMS TO THE POST according to the taxonomies they belong to
    32193219    foreach($apt_taxonomies_with_found_terms_array as $apt_single_taxonomy_with_found_terms_array){
     3220        $apt_current_taxonomy_terms = wp_get_post_terms($apt_post_id, $apt_single_taxonomy_with_found_terms_array[0], array('fields' => 'names'));
     3221        $apt_current_taxonomy_term_count = count($apt_current_taxonomy_terms);
     3222
    32203223        if($apt_number_of_added_terms_total > 0 and ($apt_settings['apt_old_terms_handling'] == 1 or $apt_settings['apt_old_terms_handling'] == 3)){ //if terms were found by the plugin; if the post has no terms, we should add them - if it already has some, it won't pass one of the first conditions in the function if $apt_settings['apt_old_terms_handling'] == 3
    32213224            wp_set_object_terms($apt_post_id, $apt_single_taxonomy_with_found_terms_array[1], $apt_single_taxonomy_with_found_terms_array[0], true); //append terms
     
    32263229            }
    32273230            else{ //no new terms/keywords were found
    3228                 if(($apt_settings['apt_old_terms_handling_2_remove_old_terms'] == 1) and ($apt_post_current_term_count > 0)){ //if no new terms were found and there are old terms, remove them all
     3231                if(($apt_settings['apt_old_terms_handling_2_remove_old_terms'] == 1) and ($apt_current_taxonomy_term_count > 0)){ //if no new terms were found and there are old terms, remove them all
    32293232                    wp_delete_object_term_relationships($apt_post_id, $apt_single_taxonomy_with_found_terms_array[0]); //remove all terms
    32303233                }
     
    45014504        die($apt_invalid_nonce_message);
    45024505    }
     4506
    45034507}
    45044508
  • automatic-post-tagger/trunk/automatic-post-tagger.php

    r1176395 r1190423  
    32183218    ### ADDING TERMS TO THE POST according to the taxonomies they belong to
    32193219    foreach($apt_taxonomies_with_found_terms_array as $apt_single_taxonomy_with_found_terms_array){
     3220        $apt_current_taxonomy_terms = wp_get_post_terms($apt_post_id, $apt_single_taxonomy_with_found_terms_array[0], array('fields' => 'names'));
     3221        $apt_current_taxonomy_term_count = count($apt_current_taxonomy_terms);
     3222
    32203223        if($apt_number_of_added_terms_total > 0 and ($apt_settings['apt_old_terms_handling'] == 1 or $apt_settings['apt_old_terms_handling'] == 3)){ //if terms were found by the plugin; if the post has no terms, we should add them - if it already has some, it won't pass one of the first conditions in the function if $apt_settings['apt_old_terms_handling'] == 3
    32213224            wp_set_object_terms($apt_post_id, $apt_single_taxonomy_with_found_terms_array[1], $apt_single_taxonomy_with_found_terms_array[0], true); //append terms
     
    32263229            }
    32273230            else{ //no new terms/keywords were found
    3228                 if(($apt_settings['apt_old_terms_handling_2_remove_old_terms'] == 1) and ($apt_post_current_term_count > 0)){ //if no new terms were found and there are old terms, remove them all
     3231                if(($apt_settings['apt_old_terms_handling_2_remove_old_terms'] == 1) and ($apt_current_taxonomy_term_count > 0)){ //if no new terms were found and there are old terms, remove them all
    32293232                    wp_delete_object_term_relationships($apt_post_id, $apt_single_taxonomy_with_found_terms_array[0]); //remove all terms
    32303233                }
     
    45014504        die($apt_invalid_nonce_message);
    45024505    }
     4506
    45034507}
    45044508
Note: See TracChangeset for help on using the changeset viewer.