0

I have two custom post types in Wordpress: Events and Venues. I need to count the number of Events associated with the individual venues and have the counts displayed in a column on the Venues page in the WordPress backend (/wp-admin/edit.php?post_type=example_venues). This is similar to the Count column that can be shown for categories and tags. I have not found any solutions or code examples for having this functionality to custom post types. Hoping someone can help point me in the right direction.

wp_posts table
ID ------ post_title ------------------------- post_type
38321 - Manchester, NH --------------- cpt_venue
1425 -- Manchester Test Event------ - cpt_events

wp_postmeta table
meta_id -- post_id - meta_key --------- meta_value
909368 -- 1425 ---- _EventVenueID -- 431
381106 -- 431 ------ _VenueCity ------- Manchester
381107 -- 431 ------ _VenueCountry - United States
381109 -- 431 ------ _VenueState ----- NH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.