Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?

There is no way easy way to do that. You have to query directly to achieve that. I am assuming, you only want the parent categories which don’t have descendants or even if they have descendants, it’s not used in any post global $wpdb; $categories = $wpdb->query(“SELECT $wpdb->terms.* FROM $wpdb->terms INNER JOIN $wpdb->term_taxonomy ON $wpdb->terms.term_id … Read more

WooCommerce – Display product child categories from specific parent

The woocommerce function get_categories() is declared in abstract-wc-product.php, because it is based on the wordpress function get_the_term_list() there is no way to get only a specific branch of a category. This absolutely isn’t the same as the wordpress function get_categories(), you can see that it is woocommerce specific by how it’s used $product->get_categories(). Besides the … Read more

Category Alphabet List Broken

ANSWER REVISITED I have just done the same type of answer on SO and took another route that is way faster than my original answer. I thought it would be nice to revisit this answer and post my new approach for benefit of this site. The name__like parameter of get_terms was changed in WordPress 3.7. … Read more

Removing the number in a category slug

You probably have a tag with the same slug. You can’t have any taxonomies with duplicate slugs. Either delete that other taxonomy, rename/change its slug, or change/rename this category. EDIT Ok, it turns out you can do this, if you don’t mind programming the fix or directly executing the SQL or messing with PHPMyAdmin. What … Read more

Showing all the posts in one page?

This is what I would consider the correct solution, and is the solution alluded to by Milo’s comment (if I am not mistaken). function alter_ppp_for_tags_wpse_88337($qry) { if ( is_tag() && $qry->is_main_query() ) { $qry->set(‘posts_per_page’,’-1′); } } add_action(‘pre_get_posts’,’alter_ppp_for_tags_wpse_88337′); Using query_posts will cause two requests to the database– the main query, and the query triggered by the … Read more

Auto add pages to category menu

Yes, it’s possible. Depending on the way you build your menu, you’d have to call the posts like this (fill in placeholders): // Call/Query the posts related to the category: $your_cat_related_cpts = get_posts( array( ‘post_type’ => ‘YOUR_CUSTOM_POST_TYPE’ ,’category’ => ‘YOUR_CATEGORY’ ) ); // Append them to your menu: foreach ( $your_cat_related_cpts as $content ) { … Read more

Save metabox checkboxes values to custom content type

I have rethought the problem: Finally, I resolve it with save_post hook: function enhanced_portfolio_categories_save_post(){ $terminos = array(); foreach ($_POST[‘my_categories’] as $key) { $custom_tax = get_term_by(‘term_id’, $key, ‘portfolio_categories’); array_push($terminos, $custom_tax->term_id); } wp_set_object_terms( $_POST[‘post_ID’], $terminos, ‘portfolio_categories’); }