Subset of Custom Post Type From Admin Menu Based on Meta Data

I understand I can associate CPTs in submenus like so: Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu

However, my question is if I have one CPT, let’s say for a ECommerce type of post type, so it would be Orders as the post type and I have orders with different meta information in their post_meta such as approved, pending, denied, etc. can I have submenus which load an admin table using WP_List_Table of a subset of the custom post type, that is based on their meta data.

So the admin menu looks like

-Orders CPT (Show All Orders in List)
–Approved Orders (Show only Approved Orders in List)
–Denied Orders (Show only Denied Orders in List)

etc.

The reason I am asking is because at first I was doing add_menu() or add_submenu() with a custom callback to generate the HTML, but then I realized this was unnecessary as I was ending up recreating the default WP_List_Table, but I don’t want multiple CPTs when they are all really subsets of the same CPT differentiated by meta-data… is this possible or should I do different CPTs somehow?

Read more here:: Subset of Custom Post Type From Admin Menu Based on Meta Data

Leave a Reply

Your email address will not be published. Required fields are marked *