Changeset 3436833
- Timestamp:
- 01/10/2026 08:26:21 PM (3 months ago)
- Location:
- jl-convert-taxonomy-terms
- Files:
-
- 4 edited
- 1 copied
-
tags/1.6 (copied) (copied from jl-convert-taxonomy-terms/trunk)
-
tags/1.6/jl-convert-taxonomy-terms.php (modified) (6 diffs)
-
tags/1.6/readme.txt (modified) (2 diffs)
-
trunk/jl-convert-taxonomy-terms.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jl-convert-taxonomy-terms/tags/1.6/jl-convert-taxonomy-terms.php
r3137137 r3436833 3 3 * Plugin Name: JL Convert Taxonomy Terms 4 4 * Description: JL Convert Taxonomy Terms plugin allows to move taxonomy terms and its children to another taxonomy with saving taxonomy hierarchy 5 * Version: 1. 55 * Version: 1.6 6 6 * Requires at least: 5.0 7 7 * Requires PHP: 7.0 … … 116 116 117 117 // adding sections 118 add_settings_section( 'jlconverttax_configuration', 'Settings', 'jlconverttax_section_descrip rion', 'jlconverttax-slug' ); // id (Slug-name to identify the section), title, callback, page slug118 add_settings_section( 'jlconverttax_configuration', 'Settings', 'jlconverttax_section_description', 'jlconverttax-slug' ); // id (Slug-name to identify the section), title, callback, page slug 119 119 120 120 // adding fields for section … … 125 125 126 126 127 function jlconverttax_section_descrip rion() {127 function jlconverttax_section_description() { 128 128 ?> 129 129 <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> … … 295 295 foreach($categories as $category) { 296 296 $category_name = $category->name; 297 $ances ors = get_ancestors( intval( $category->term_id ), $taxonomy_name, 'taxonomy' ) ;298 $ances ors = count( $ancesors );299 $margin = 20* $ances ors;297 $ancestors = get_ancestors( intval( $category->term_id ), $taxonomy_name, 'taxonomy' ) ; 298 $ancestors = count( $ancestors ); 299 $margin = 20* $ancestors; 300 300 ?> 301 301 <div style="margin-left: <?php echo intval( $margin )."px" ?>"> … … 320 320 321 321 add_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; 323 326 $convert_from = get_option( "jlconverttax-from-taxonomy" ); 324 327 $convert_to = get_option( "jlconverttax-to-taxonomy" ); … … 331 334 $term_parent = get_term($term_id)->parent; 332 335 } 333 $table = 'wp_term_taxonomy'; 336 global $wpdb; 337 $table = $wpdb->term_taxonomy; 334 338 $data = array( 335 339 'taxonomy' => $convert_to, 336 340 ); 337 341 $where = array('term_id' => $term_id); 338 global $wpdb;339 342 $updated = $wpdb->update( $table, $data, $where ); 340 343 if ( $updated ) { 344 clean_term_cache( $term_id, $convert_from ); 341 345 // 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 } 343 350 } else { 344 351 // error; -
jl-convert-taxonomy-terms/tags/1.6/readme.txt
r3137137 r3436833 3 3 Tags: convert taxonomy term, move taxonomy term, covert categories, convert tags, convert taxonomies, move tags to categories 4 4 Requires at least: 5.0 5 Tested up to: 6. 65 Tested up to: 6.9 6 6 Requires PHP: 7.0 7 Stable tag: 1. 57 Stable tag: 1.6 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl.html … … 38 38 == Upgrade Notice == 39 39 40 1.6 41 Fixed database table prefix issue, improved performance and data consistency, enhanced error handling. 42 40 43 1.5 41 44 Upgrade version to 1.5 - tested on WP 6.6 -
jl-convert-taxonomy-terms/trunk/jl-convert-taxonomy-terms.php
r3137137 r3436833 3 3 * Plugin Name: JL Convert Taxonomy Terms 4 4 * Description: JL Convert Taxonomy Terms plugin allows to move taxonomy terms and its children to another taxonomy with saving taxonomy hierarchy 5 * Version: 1. 55 * Version: 1.6 6 6 * Requires at least: 5.0 7 7 * Requires PHP: 7.0 … … 116 116 117 117 // adding sections 118 add_settings_section( 'jlconverttax_configuration', 'Settings', 'jlconverttax_section_descrip rion', 'jlconverttax-slug' ); // id (Slug-name to identify the section), title, callback, page slug118 add_settings_section( 'jlconverttax_configuration', 'Settings', 'jlconverttax_section_description', 'jlconverttax-slug' ); // id (Slug-name to identify the section), title, callback, page slug 119 119 120 120 // adding fields for section … … 125 125 126 126 127 function jlconverttax_section_descrip rion() {127 function jlconverttax_section_description() { 128 128 ?> 129 129 <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> … … 295 295 foreach($categories as $category) { 296 296 $category_name = $category->name; 297 $ances ors = get_ancestors( intval( $category->term_id ), $taxonomy_name, 'taxonomy' ) ;298 $ances ors = count( $ancesors );299 $margin = 20* $ances ors;297 $ancestors = get_ancestors( intval( $category->term_id ), $taxonomy_name, 'taxonomy' ) ; 298 $ancestors = count( $ancestors ); 299 $margin = 20* $ancestors; 300 300 ?> 301 301 <div style="margin-left: <?php echo intval( $margin )."px" ?>"> … … 320 320 321 321 add_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; 323 326 $convert_from = get_option( "jlconverttax-from-taxonomy" ); 324 327 $convert_to = get_option( "jlconverttax-to-taxonomy" ); … … 331 334 $term_parent = get_term($term_id)->parent; 332 335 } 333 $table = 'wp_term_taxonomy'; 336 global $wpdb; 337 $table = $wpdb->term_taxonomy; 334 338 $data = array( 335 339 'taxonomy' => $convert_to, 336 340 ); 337 341 $where = array('term_id' => $term_id); 338 global $wpdb;339 342 $updated = $wpdb->update( $table, $data, $where ); 340 343 if ( $updated ) { 344 clean_term_cache( $term_id, $convert_from ); 341 345 // 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 } 343 350 } else { 344 351 // error; -
jl-convert-taxonomy-terms/trunk/readme.txt
r3137137 r3436833 3 3 Tags: convert taxonomy term, move taxonomy term, covert categories, convert tags, convert taxonomies, move tags to categories 4 4 Requires at least: 5.0 5 Tested up to: 6. 65 Tested up to: 6.9 6 6 Requires PHP: 7.0 7 Stable tag: 1. 57 Stable tag: 1.6 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl.html … … 38 38 == Upgrade Notice == 39 39 40 1.6 41 Fixed database table prefix issue, improved performance and data consistency, enhanced error handling. 42 40 43 1.5 41 44 Upgrade version to 1.5 - tested on WP 6.6
Note: See TracChangeset
for help on using the changeset viewer.