How do I add custom fields to my bulk/quick edit page?

If the fields you want aren't already showing up automatically at WP Admin > Settings > Custom Bulk/Quick Edit, then you'll need to manually configure them.

In a best case scenario, the name of the post meta field and those shown in the columns are same. Therefore, the quick and easy code below is for you. If not, you'll need to check out the Working Examplesbelow for dealing with different incoming, shown, and saved field names. 

You'll need to know the custom key name of the field you're wanting to change and the values associated with them. You'll probably need to dig through your plugin or theme code for these. Then in your theme's `functions.php` file add code similar to the following.

add_filter( 'manage_post_posts_columns', 'my_manage_post_posts_columns' );
function my_manage_post_posts_columns( $columns ) {
	$columns['custom_stuff'] = esc_html__( 'Custom Stuff Here' );

	return $columns;
}

As an example of working with a custom post type named `news-room`, try the following.

add_filter( 'manage_news-room_posts_columns', 'my_manage_newsroom_posts_columns' );
function my_manage_newsroom_posts_columns( $columns ) {
	$columns['wpcf-publication-author'] = esc_html__( 'Publication Author');
	$columns['wpcf-newsroom-type']      = esc_html__( 'News Room Type');
	$columns['_views_template']         = esc_html__( 'Content Template');

	return $columns;
}

This is based upon the filter manage_${post_type}_posts_columns for the `post` post type.

Once you've got these, you can check Value configurations to finish up your Settings > CBQE options.

Working Examples

Check out the article Where can I find working samples? for more help.

What About Excerpts?

If your theme supports excerpts, then try the following in your filter.

$columns['post_excerpt'] = esc_html__( 'Excerpt');

Don't Forget!

Once you add your fields, go back to WP Admin > Settings > Custom Bulk/Quick to enable the field.

Thank you to widecast for this reminder.

Have more questions? Submit a request

Comments

Powered by Zendesk