Plugin Directory

Changeset 3436833


Ignore:
Timestamp:
01/10/2026 08:26:21 PM (3 months ago)
Author:
lovecoding
Message:

tagging version 1.6

Location:
jl-convert-taxonomy-terms
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • jl-convert-taxonomy-terms/tags/1.6/jl-convert-taxonomy-terms.php

    r3137137 r3436833  
    33 * Plugin Name: JL Convert Taxonomy Terms
    44 * Description: JL Convert Taxonomy Terms plugin allows to move taxonomy terms and its children to another taxonomy with saving taxonomy hierarchy
    5  * Version: 1.5
     5 * Version: 1.6
    66 * Requires at least: 5.0
    77 * Requires PHP: 7.0
     
    116116
    117117    // adding sections
    118     add_settings_section( 'jlconverttax_configuration', 'Settings', 'jlconverttax_section_descriprion', 'jlconverttax-slug' );  // id (Slug-name to identify the section), title, callback, page slug
     118    add_settings_section( 'jlconverttax_configuration', 'Settings', 'jlconverttax_section_description', 'jlconverttax-slug' );  // id (Slug-name to identify the section), title, callback, page slug
    119119
    120120    // adding fields for section
     
    125125
    126126
    127 function jlconverttax_section_descriprion() {
     127function jlconverttax_section_description() {
    128128    ?>
    129129    <p><?php esc_html_e( "When You choose 'Yes' in 'Save taxonomy hierarchy' section, you must move first-level parent with all its children to new hierarchical taxonomy, to all moved taxonomies was visible.", "jlconverttax") ?></p>
     
    295295    foreach($categories as $category) {
    296296        $category_name = $category->name;
    297         $ancesors = get_ancestors( intval( $category->term_id ), $taxonomy_name, 'taxonomy' ) ;
    298         $ancesors = count( $ancesors );
    299         $margin = 20* $ancesors;
     297        $ancestors = get_ancestors( intval( $category->term_id ), $taxonomy_name, 'taxonomy' ) ;
     298        $ancestors = count( $ancestors );
     299        $margin = 20* $ancestors;
    300300        ?>
    301301        <div style="margin-left: <?php echo intval( $margin )."px" ?>">
     
    320320
    321321add_action('updated_option', function( $option_name, $old_value, $value ) {
    322     $change_terms = get_option( "jlconverttax-checked-categories", 1 );
     322    if ( 'jlconverttax-checked-categories' !== $option_name ) {
     323        return;
     324    }
     325    $change_terms = $value;
    323326    $convert_from = get_option( "jlconverttax-from-taxonomy" );
    324327    $convert_to = get_option( "jlconverttax-to-taxonomy" );
     
    331334                $term_parent = get_term($term_id)->parent;
    332335            }
    333             $table = 'wp_term_taxonomy';
     336            global $wpdb;
     337            $table = $wpdb->term_taxonomy;
    334338            $data = array(
    335339                'taxonomy' => $convert_to,
    336340            );
    337341            $where = array('term_id' => $term_id);
    338             global $wpdb;
    339342            $updated = $wpdb->update( $table, $data, $where );
    340343            if ( $updated ) {
     344                clean_term_cache( $term_id, $convert_from );
    341345                // update term in new term context
    342                 wp_update_term($term_id, $convert_to, array( 'parent' => $term_parent ));       // wp_update_term($term_id, $term_taxonomy (new changed taxonomy - new context), $args);
     346                $result = wp_update_term($term_id, $convert_to, array( 'parent' => $term_parent ));
     347                if ( !is_wp_error( $result ) ) {
     348                    clean_term_cache( $term_id, $convert_to );
     349                }
    343350            } else {
    344351                // error;
  • jl-convert-taxonomy-terms/tags/1.6/readme.txt

    r3137137 r3436833  
    33Tags: convert taxonomy term, move taxonomy term, covert categories, convert tags, convert taxonomies, move tags to categories
    44Requires at least: 5.0
    5 Tested up to: 6.6
     5Tested up to: 6.9
    66Requires PHP: 7.0
    7 Stable tag: 1.5
     7Stable tag: 1.6
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    3838== Upgrade Notice ==
    3939
     401.6
     41Fixed database table prefix issue, improved performance and data consistency, enhanced error handling.
     42
    40431.5
    4144Upgrade version to 1.5 - tested on WP 6.6
  • jl-convert-taxonomy-terms/trunk/jl-convert-taxonomy-terms.php

    r3137137 r3436833  
    33 * Plugin Name: JL Convert Taxonomy Terms
    44 * Description: JL Convert Taxonomy Terms plugin allows to move taxonomy terms and its children to another taxonomy with saving taxonomy hierarchy
    5  * Version: 1.5
     5 * Version: 1.6
    66 * Requires at least: 5.0
    77 * Requires PHP: 7.0
     
    116116
    117117    // adding sections
    118     add_settings_section( 'jlconverttax_configuration', 'Settings', 'jlconverttax_section_descriprion', 'jlconverttax-slug' );  // id (Slug-name to identify the section), title, callback, page slug
     118    add_settings_section( 'jlconverttax_configuration', 'Settings', 'jlconverttax_section_description', 'jlconverttax-slug' );  // id (Slug-name to identify the section), title, callback, page slug
    119119
    120120    // adding fields for section
     
    125125
    126126
    127 function jlconverttax_section_descriprion() {
     127function jlconverttax_section_description() {
    128128    ?>
    129129    <p><?php esc_html_e( "When You choose 'Yes' in 'Save taxonomy hierarchy' section, you must move first-level parent with all its children to new hierarchical taxonomy, to all moved taxonomies was visible.", "jlconverttax") ?></p>
     
    295295    foreach($categories as $category) {
    296296        $category_name = $category->name;
    297         $ancesors = get_ancestors( intval( $category->term_id ), $taxonomy_name, 'taxonomy' ) ;
    298         $ancesors = count( $ancesors );
    299         $margin = 20* $ancesors;
     297        $ancestors = get_ancestors( intval( $category->term_id ), $taxonomy_name, 'taxonomy' ) ;
     298        $ancestors = count( $ancestors );
     299        $margin = 20* $ancestors;
    300300        ?>
    301301        <div style="margin-left: <?php echo intval( $margin )."px" ?>">
     
    320320
    321321add_action('updated_option', function( $option_name, $old_value, $value ) {
    322     $change_terms = get_option( "jlconverttax-checked-categories", 1 );
     322    if ( 'jlconverttax-checked-categories' !== $option_name ) {
     323        return;
     324    }
     325    $change_terms = $value;
    323326    $convert_from = get_option( "jlconverttax-from-taxonomy" );
    324327    $convert_to = get_option( "jlconverttax-to-taxonomy" );
     
    331334                $term_parent = get_term($term_id)->parent;
    332335            }
    333             $table = 'wp_term_taxonomy';
     336            global $wpdb;
     337            $table = $wpdb->term_taxonomy;
    334338            $data = array(
    335339                'taxonomy' => $convert_to,
    336340            );
    337341            $where = array('term_id' => $term_id);
    338             global $wpdb;
    339342            $updated = $wpdb->update( $table, $data, $where );
    340343            if ( $updated ) {
     344                clean_term_cache( $term_id, $convert_from );
    341345                // update term in new term context
    342                 wp_update_term($term_id, $convert_to, array( 'parent' => $term_parent ));       // wp_update_term($term_id, $term_taxonomy (new changed taxonomy - new context), $args);
     346                $result = wp_update_term($term_id, $convert_to, array( 'parent' => $term_parent ));
     347                if ( !is_wp_error( $result ) ) {
     348                    clean_term_cache( $term_id, $convert_to );
     349                }
    343350            } else {
    344351                // error;
  • jl-convert-taxonomy-terms/trunk/readme.txt

    r3137137 r3436833  
    33Tags: convert taxonomy term, move taxonomy term, covert categories, convert tags, convert taxonomies, move tags to categories
    44Requires at least: 5.0
    5 Tested up to: 6.6
     5Tested up to: 6.9
    66Requires PHP: 7.0
    7 Stable tag: 1.5
     7Stable tag: 1.6
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    3838== Upgrade Notice ==
    3939
     401.6
     41Fixed database table prefix issue, improved performance and data consistency, enhanced error handling.
     42
    40431.5
    4144Upgrade version to 1.5 - tested on WP 6.6
Note: See TracChangeset for help on using the changeset viewer.