Can I customize the post backend interface?

When working with complex post types, you might want to customize the columns in the WordPress backend to have a clearer overview of your posts, e.g. add custom columns, hide certain columns or have a custom order. This is something we plan to add to Greyd.Suite in the upcoming months.

In the meantime, we have prepared a code snippet you that you can adapt and add for example to the functions.php of your child theme:

// change this to your post type slug
$my_cpt_slug = 'my_custom_post_type';

// add the column to the post type
add_filter( 'manage_' . $my_cpt_slug . '_posts_columns', function ( $columns ) {

	// change 'field' to the name of your column
	$column_name = 'my_column_name';

	$columns[ $column_name ] = __( 'Feld' );
	return $columns;
} );

// render the column content
add_action( 'manage_' . $my_cpt_slug . '_posts_custom_column', function ( $column, $post_id ) {

	// change 'field' to the name of your column
	$column_name = 'my_column_name';

	// change this to the key of your meta field
	$meta_field_key = 'my_custom_field_key';

	// render the column content
	if ( $column_name === $column ) {
		echo get_dynamic_field( $meta_field_key, $post_id );
	}

}, 10, 2);
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us