Monthly Archives: April 2021

add postmeta on wp admin



add_filter('manage_post_posts_columns', function($columns) {
	return array_merge($columns, ['source_domain' => __('URL', 'textdomain')]);
});
 
add_action('manage_post_posts_custom_column', function($column_key, $post_id) {
	if ($column_key == 'source_domain') {
		$source_domain = get_post_meta($post_id, 'source_domain', true);
		//if ($source_domain == 1) {} else {}
		echo $source_domain;
	}
}, 10, 2);

As seen on

https://awhitepixel.com/blog/modify-add-custom-columns-post-list-wordpress-admin/