Skip to content

Instantly share code, notes, and snippets.

@dnshulga
Last active June 5, 2019 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnshulga/a3209a87be80bbcc5d5e2b2540a2f7f5 to your computer and use it in GitHub Desktop.
Save dnshulga/a3209a87be80bbcc5d5e2b2540a2f7f5 to your computer and use it in GitHub Desktop.
Add a custom column from ACF field to taxonomy edit page
<?php
function custom_column_header( $columns ){
$columns['image'] = 'Image';
unset($columns['description']);
return $columns;
}
add_filter( "manage_edit-arts_cat_columns", 'custom_column_header', 10);
function custom_column_content( $value, $column_name, $term_id ){
if ($column_name === 'image') {
$term = get_term($term_id);
$columns = '<img src="'.get_field('thumbnail', $term)['sizes']['medium'].'" width="100" alt=""/>';
}
return $columns;
}
add_action( "manage_arts_cat_custom_column", 'custom_column_content', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment