Here is your solution-
add_filter( 'wp_setup_nav_menu_item','the_dramatist_item_setup' );
function the_dramatist_item_setup($item) {
if ('taxonomy' === $item->type) {
$posts = get_posts( array(
'post_type' => 'post',
'numberposts' => -1,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => $item->object_id, // Where term_id of Term 1 is "1".
'include_children' => false
)
)
) );
$item->title = $item->title . '(' . count( $posts ) . ')';
}
return $item;
}
Related Posts:
- get_the_term_list without links in 3.1
- Custom columns on edit-tags.php main page
- get_term_children for immediate children only (not grandchildren)
- Custom taxonomies capabilities
- Can’t get a custom template taxonomy page to display
- Display category posts grouped by taxonomy
- Creating a non-removable taxonomy term
- Can I turn off write-in tags/taxonomies?
- Is it possible to use one slug for Multiple Taxonomies?
- Is it possible to add taxonomies to user profiles?
- Get terms from multiple taxonomies
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- Displaying the Name of the Queried Taxonomy Term on a Term Archive Page?
- How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)
- Is it possible to sort the post based on a custom field?
- How do I get terms as a list for a specific post?
- get taxonomy terms for parent and child
- On Taxonomy Template page, want to add Post_Type
- Taxonomy query for children of parents
- Separator for multiple terms
- The next_posts_link() show me a aditional page in blank
- Help building array hierarchically with taxonomies (to get posts)
- Removing the base “Author” or changing it to something else. is it possible?
- how to get title to custom tags page
- What are terms and taxonomy, how they related to post and how these three are stored in database?
- Get multiple term objects by ids
- Echo custom taxonomy term name
- Next and Previous links on a single taxonomy page only link to same term
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- How can I get WP to build a feed based on multiple taxonomy terms
- Get custom taxonomy description with paragraph tags
- Getting the selected terms for custom taxonomies in the editor
- Change permalink of post if it belongs to custom taxonomy
- Get pages only with a specific taxonomy
- Set custom post type terms by id without knowing taxonomy
- Share taxonomy between user and posts?
- How to determine the depth of a term in a custom taxonomy?
- How do I Use Multiple Loops with WP_Query?
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- How to obtain the link/URL to the feed of a custom taxonomy?
- get_term_children doesn’t return an array of children terms
- Term count by user
- Catchable fatal error on custom category post
- add taxonomy as one of menu items
- How to add contents of a custom field to a taxonomy term list?
- Google Map Shortcode for Custom Taxonomy/Post Types
- Querying two taxonomies
- How to target parent product category and its children using WooCommerce?
- Custom taxonomy query is empty. 0 = 1 in SQL
- How do you reorder the custom taxonomies on the right side of a custom post edit page?
- Query posts by taxonomy with current term
- Custom Taxonomies not retaining hierarchy while importing from one site to another
- What is the most efficient way of implementing a notification system? [closed]
- Remove custom taxonomy column from my custom post type columns
- Get posts by Taxonomy without terms
- Check if custom taxonomy has posts with get_categories()
- How to add images to taxonomy terms? [duplicate]
- Echo custom taxonomy slug
- Admin (All posts) stop responding problem
- Why get_page_template() doesn’t show taxonomy template file name?
- Remove a href from this code
- Adding a second custom taxonomy to a custom post type (both shown in its table)?
- custom post type, hide or disable the status line in publish meta box
- Get post terms from multiple custom taxonomies
- How to get attached image to taxonomy..?
- delete term from taxonomy and assign in new one
- How to get list of only custom taxonomies?
- Template file renders on local install, not on web
- Disable a Custom Taxonomies default save mechanism
- Replicate Drupal form options as taxonomies?
- Listing only custom post types with two required categories?
- custom taxonomies label in hebrew
- Amend taxonomy to search in wordpress admin
- Unique taxonomy for post
- Product custom taxonomy is not found when space in name
- Display term picture of each post in a loop
- filter for thumbnail not working for custom taxonomy term
- Custom taxonomy only gets saved in quick edit
- Get tags name under custom taxonomy in wordpress
- Show message if term slug changed
- Get post meta value outside of the loop
- Unable to create a new taxonomy
- Code inside conditional is_tax() only working when term has posts
- Change link of taxonomy when get_the_term_list( is used?
- Get link for taxonomy to show top-level terms
- Invalid taxonomy with custom script
- Custom Taxonomy – Dropdown
- How to show selected check box vendors on front end home page?
- custom taxonomy don’t return a value
- Where to put a migration script to switch post information?
- Gravity prerender taxonomy [closed]
- Advanced search: roles and multiple taxonomies
- One taxonomy template for all categories?
- Get post terms with hierarchical relationships
- Removing fields from category/taxonomy edit form
- Error in Custom Taxonomy UI
- Remove ‘portfolio’ from URL
- Add text in custom taxonomy
- How do I check if a post has a term with a particular ancestor/parent?
- Best approach of implementing multi-select/checkboxes for taxonomies?