Add Admin Column showing ACF Post Object's field
<?php // remove this tag
// ADD NEW COLUMN
function JOBDIVISION_columns_head($defaults) {
$defaults['division_post_obj'] = 'Division'; // Replace with your column name
return $defaults;
}
// SHOW THE TITLE
function JOBDIVISION_columns_content($column_name, $post_ID) {
if ($column_name == 'division_post_obj') {
if( get_field('division_cpt') ) { // Display only if a post object is specified - replace division_cpt with your custom field
$thisJobID = get_field('division_cpt'); // Specify the Post Object slug to grab the linked its ID
echo get_the_title($thisJobID); // Now that we've got the ID we can grab any field or custom field we want
}
}
}
add_filter('manage_job_posts_columns', 'JOBDIVISION_columns_head'); // Replace 'job' with your CPT slug
add_action('manage_job_posts_custom_column', 'JOBDIVISION_columns_content', 10, 2); // Replace 'job' with your CPT slug