Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Category Posts in Custom Menu

Dynamic menus: List all posts from a category in your menu. Also works for tags, custom taxonomies as well as pages and custom post types.

The custom menu only allows adding a link that leads to a list of posts and pages belonging to a taxonomy (category, tag, etc). If you want to list the posts and pages themselves and if you want WordPress to do this automatically for you, then I hope you will find this plugin useful.

Also works for custom taxonomies and custom post types!

Using it

Enable the plugin and go to Appearance > Menus. Create your Custom Menu. Add a taxonomy (category/tag/custom) to the menu. Next, you can choose if you would like to replace the original link (to a page that lists the items) by the posts and pages themselves.

For each Category or Post Tag item in the menu, you now have the following extra configuration options:

  • replace the link by a list of posts in the menu y/n;
  • specify the (maximum) number of posts you want to show for this item (-1 = all, 0 also allowed now);
  • their ordering ascending or descending by ID, Author, Title and other properties. See 'Other Notes > Ordering';
  • keep or remove the original menu item (always / only if there are no posts / never);
  • specify the title for the menu items. For this you can use %post_title, %post_author and other wildcards, see 'Other Notes > Wildcards'.


This plugin uses the wp_nav_menu_objects filter hook to remove and replace category items in the menu by the posts in that category. It extends Walker_Nav_Menu_Edit to add input fields to Appearance > Menus and adds some CSS to style this properly.

The plugin now supports the wp_nav_menu_item_custom_fields hook and should be compatible with other plugins that also use this hook.


You can control the title of the menu items generated by the plug-in with the following wildcards:

  • %post_title
  • %post_author
  • %post_featured_image_url
  • %post_featured_image (insers an HTML 'img' tag with the featured image or nothing if there is none)
  • %post_featured_image_thumb_url
  • %post_featured_image_thumb (insers an HTML 'img' tag with the featured image thumbnail or nothing if there is none)
  • %post_excerpt
  • %post_url
  • %post_date for the unformatted post date: 2012-11-10 18:14:23
  • %post_date() for a formatted post date with the following default formatting: November 10th, 2012
  • %post_date(<your formatting here>) for custom date formatting. Example: %post_date(l jS \of F Y, h:i:s A). See http://codex.wordpress.org/Formatting_Date_and_Time for formatting options.
  • %post_date_gmt
  • %post_date_gmt()
  • %post_date_gmt(<your formatting here>)
  • %post_status
  • %post_modified
  • %post_modified()
  • %post_modified(<your formatting here>)
  • %post_modified_gmt
  • %post_modified_gmt()
  • %post_modified_gmt(<your formatting here>)
  • %post_comment_count
  • wildcards for custom fields, like %post_my_field, where 'my field' or 'my_field' is a custom field

The following wildcards are deprecated:

  • %post_feat_image (url only)
  • %post_feat_image_thumb (url only)


You can control the ordering of the items in the menu by sorting ascending or descending on the following properties:

  • None
  • ID
  • Author
  • Title
  • Date
  • Last Modified
  • Post/Page parent ID
  • Random Order
  • Number of Comments
  • Menu Order - Ordering by menu order is only possible for hierarchical types, such as pages. These have the 'Order' option when editing, this is the menu order.

Extend the plugin

The plugin behavior can be extended.

To extend the backend with your own controls and use them in the posts query, add the following:

  • Action "cpcm_custom_fields": Use this to extend the custom fields to add to the Category Posts in Custom Menu container in Appearance > Menus
  • Filter "cpcm_filter_posts_query": This filter is called when the menu_item is of taxonomy type and the "Create submenu containing links to posts in this category" is checked. Here, you can add or modify the posts query to your liking.

To add your own wildcards, add the following:

  • Filter "cpcm_replace_user_wildcards": Called after all default CPCM wildcards have been processed.

You can see an example in the sample-cpcm-extension directory, included in the plugin code.

Requires: 3.2.1 or higher
Compatible up to: 4.7.1
Last Updated: 1 month ago
Active Installs: 7,000+


4.9 out of 5 stars


0 of 3 support threads in the last two months have been marked resolved.

Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 0,2,0 100,1,1
100,1,1 100,2,2
100,2,2 100,1,1