Best pratice to make taxonomy terms translatable without changing slugs?

I’m not really up to date on WPML and how it handles translations, but my general understanding is that in most cases it simply creates duplicate entries for each language and links them together with the “original”. However, I recently hade a similar problem where I needed the ability to add a “pluralized” version of … Read more

Modify Term Update Redirection

I agree with you, it’s somewhat an unexpected user experience, when you’re redirected after updating a term. Additionally there seems to be no error handling on the form itself, if you try to make some errors, like deleting the term name and slug, it will not show any errors, just ignore your changes and redirect. … Read more

wp_set_object_terms and arrays

I doubt it would justify the effort of writing custom SQL queries for only 2500 posts. Within the wp_set_object_terms( $object_id, … ) function we have: $object_id = (int) $object_id; so it’s correct that it only takes a single post id as input. So you would need to loop over your $post_ids array but it might … Read more

get_terms name__like list categories according to letter

Use the terms_clauses filter, which passes all the various components of the query (fields, join, where, orderby, order & limits), and implement your own “search” argument: function wpse_178511_get_terms_fields( $clauses, $taxonomies, $args ) { if ( ! empty( $args[‘surname’] ) ) { global $wpdb; $surname_like = $wpdb->esc_like( $args[‘surname’] ); if ( ! isset( $clauses[‘where’] ) ) … Read more

Get multiple term IDs by slug, and then exclude them in get_terms

You can get terms, from multiple slugs, with the slug argument: $exclude = get_terms ( [ ‘slug’ => [ ‘president’, ‘vice-president’, ‘admin’, ‘rnd’ ], ‘taxonomy’ => $cat_type, ‘fields’ => ‘ids’, ] ); where we use the fields argument to return only term ids.

Get terms that contain posts that in turn belong to other terms?

This should get you the names of all such terms in an array $wpdb->get_col(“SELECT DISTINCT {$wpdb->terms}.name FROM {$wpdb->terms} INNER JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_id = {$wpdb->terms}.term_id INNER JOIN {$wpdb->term_relationships} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id WHERE {$wpdb->term_taxonomy}.taxonomy = ‘shape’ AND {$wpdb->term_relationships}.object_id IN ( SELECT object_id FROM {$wpdb->term_relationships} INNER JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id WHERE {$wpdb->term_taxonomy}.taxonomy = ‘color’ … Read more