WPML Translating a term/taxonomy programmatically

Ok I found the solution. Actually taxonomy name on icl_translation table is stored with prefix called “tax_” which means taxonomy. The above code would work like this: $trid = $sitepress->get_element_trid($englist_term_id, “tax_taxonomy_name”); $sitepress->set_element_language_details($new_term_id, “tax_taxonomy_name”, $trid, $lang_code, $sitepress->get_default_language()); The difference is tax_ prefix. Cheers!

Custom permalink – append taxonomy name and term name at the end of permalink

You can achieve the following permalink structure by simply overriding (without having to remove) the default one (you specified) for the resources post type: /resources/%resources%/resources-type/%resources_type% <- preferred /resources/resources-type/%resources_type%/%resources% <- default And you can override it via add_permastruct() — first, register the post type without specifying the rewrite parameter which means the rewrite defaults to true/enabled … Read more

How to dynamically add custom taxonomy terms as a sub-menu of an existing menu item, using custom walker class

Okay, I figured it out. It’s not very smooth, but at least it works as I want it to. Will have to do some refactoring. The issue was that wp_nav_menu() got called earlier than the taxonomy registration. I had accidentally placed it in my theme-functions.php and forgotten about it, then called it again in my … Read more

how to create a proper query for getting a list of users with taxonomy related meta key

Objective I want to list sp_provider (hospital,clinics,doctors) whose sub_category is suppose ‘neurology’ rephrasing the words: I want to list users with sp provider category(meta value) such as “hospital” and the user have a sub category(meta value) “neurology” sp_provider is a meta value in user profile (sp-provider maybe a post-type or something for user management screen … Read more

drop-down list taxonomy problem

Not sure exactly what you’re asking. Do you just want to include a blank value before the list of terms? Would this work: echo ‘<option value=”#”> – Select – </option>’; (inserted just before the line foreach($terms as $term) {)

How to get the first term for the current taxonomy?

You can use get_queried_object to get the term name. <?php if( is_tax() ) { global $wp_query; $term = $wp_query->get_queried_object(); $title= $term->name; } ?> To display: <?php echo $title; ?> If your on a taxonomy archive page you can use: <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); ?> Then to display … Read more