[SOLVED] Add a Custom Column in Custom Post Types Admin Screen Displaying Relational Data From Another Custom Post Type

I had a situation recently with WordPress where I had to display the Company Name against the Attendee profile when viewing a list of Attendees inside the WordPress admin.

Basically there was two custom post types (CPT’s), one was called “attendee” and the other “companies”. When editing an Attendee record we would assign it to a company so that we knew which Company the Attendee was assigned to.

After some ideas from the Advanced WordPress forum on Facebook, this is what I ended up with and code is included below.

custom-column-in-custom-post-type-admin-screen

Here is the code which I inserted into the themes functions.php to display the company name against the attendee record.