Only return taxonomies that are linked to a category & product

This will find all terms in custom taxonomy underkategorier and then will show terms with post from chosen category. $taxonomies = get_taxonomies(array(‘name’=>’underkategorier’),’object’); foreach($taxonomies as $taxonomy) { $terms = get_terms( $taxonomy->name, ‘orderby=count&hide_empty=0’ ); foreach($terms as $term) { $wpq = array (‘taxonomy’=>’underkategorier’,’term’=>$term->slug, “cat”=>10); $myquery = new WP_Query ($wpq); $article_count = $myquery->post_count; echo $term->name.’ ‘.$article_count; //with empty ones … Read more

Set “editor” role to existing user

Usermeta key that stores the user’s role has a prefix in the name, the one set in the wp-config.php file. So meta_key will have the form {prefix}_capabilities and your query should look like global $wpdb; $wpdb->query( $wpdb->prepare( “UPDATE {$wpdb->usermeta} SET meta_value=”a:1:{s:6:\”editor\”;b:1;}” WHERE user_id = %d AND meta_key = ‘{$wpdb->prefix}capabilities'”, $user_id ) ); You do not … Read more