How do I get a list of all categories that a given user has written blog posts for?

As, much as I know about WordPress we have to ways to achieve this. First: You have to retrieve all posts written by an author an then you can fetch categories assigned to those posts. Store them in an array uniquely. $args = array(‘author’ => $author->ID, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’); $authorArticles = get_posts($args); … Read more

wp_dropdown_categories and custom taxonomy + custom post type

You can get your code to work the expected way by adding the following three arguments to your $args array which you pass to wp_dropdown_categories(): name — the select name as in <select name=”<here>”>, and you should set it to theme which is your custom taxonomy slug. value_field — the value of the <option>‘s in … Read more

Sorting taxonomy columns by meta value numeric

The code I am posting is a modified and simplified version of yours. I got my solution using your code. /** * Filter WP_Term_Query meta query * * @param object $query WP_Term_Query * @return object */ function filter_terms_clauses( $pieces, $taxonomies, $args ) { global $pagenow, $wpdb; if(!is_admin()) { return $pieces; } if( is_admin() && $pagenow … Read more

Exclude specific taxonomy term when using wp_get_post_terms

I’d use wp_list_filter() with the operator ‘NOT’ to compare either the term’s name, slug or ID (depending how you want to test for term to be exluded). Untested but something like this should work (assuming that you want to exclude the term with slug ‘myslug’): $terms = wp_get_post_terms( $post->ID, ‘wedding_cat’); $terms = wp_list_filter($terms, array(‘slug’=>’myslug’),’NOT’); (Of … Read more

How to count the number of terms in a taxonomy

As @shanebp suggests, you could use wp_count_terms() like this: $numTerms = wp_count_terms( ‘service-category’, array( ‘hide_empty’=> false, ‘parent’ => 0 ) ); The above will list All top parent terms, empty or not. This function uses get_terms() functions arguments which can be found in the link or the arguments below: $args = array( ‘orderby’ => ‘name’, … Read more

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