How can I display all post IDs from the taxonomy?

Just some code to get started. This will get you all the IDs for job_listings that are assigned to term 4 in your taxonomy. <?php $posts = get_posts( array( ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, ‘post_type’ => ‘job_listing’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘agency’, ‘field’ => ‘term_id’, ‘terms’ => 4 ) ) ) ); … Read more

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!

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 a list of taxonomy terms which are being used only within certain post types?

I’m not a programmer so there’s probably a far more efficient/correct way of doing this. Put this in functions.php or a custom plugin: function get_terms_by_post_type( $taxonomies, $post_types ) { global $wpdb; $query = $wpdb->get_results( “SELECT t.*, COUNT(*) from $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN $wpdb->term_relationships AS r … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)