Previous/next link to post in category, NOT tag?

Defaults First, you don’t have to put ‘« %link’ in, as this is already the default value. WPDB Query Your “Problem” is, that the underlying funtion adjacent_post_link() uses get_adjacent_post() if it’s not querying an attachment. This then builds the following JOIN part for the query: INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER … Read more

Sort post’s categories by ID

You’re using wrong arguments for get_the_category_list function. The function you should use for this is wp_get_object_terms http://codex.wordpress.org/Function_Reference/wp_get_object_terms

Exclude category from loop not working

Don’t use query_posts(). Use pre_get_posts instead: function wpse82745_filter_pre_get_posts( $query ) { // Only modify the main loop, // and only in the blog posts index if ( is_home() && $query->is_main_query() ) { $query->set( ‘category__not_in’, array( ’13’ ) ); } } add_action( ‘pre_get_post’, ‘wpse82745_filter_pre_get_posts’ ); This callback will exclude category 13 from the main loop in … Read more

Woocommerce – Get product category 2nd level category

Assuming you know the parent category ID, you can use get_terms() function. $args = array( ‘parent’ => 100 // id of the direct parent ); $cats = get_terms( ‘product_cat’, $args ); foreach( $cats as $cat ) { echo $cat->name; } Here is more information on this function and additional arguments you can use. http://codex.wordpress.org/Function_Reference/get_terms

When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?

You’re doing it correct @its_me. The latter, get_term_by() would be the best way, In my opinion , as I believe get_category_by_path uses get_term_by, just prepopulating the taxonomy to be category. Edit: As I mentioned in my comment, get_category_by_path is much less efficient, since it gets multiple terms,. and then compares the hierarchical path. get_term_by is … Read more