Skip to content

Instantly share code, notes, and snippets.

@juniorthiesen
Created May 8, 2017 22:07
Show Gist options
  • Save juniorthiesen/17988a9b12f748554e19de1d90fa9cb4 to your computer and use it in GitHub Desktop.
Save juniorthiesen/17988a9b12f748554e19de1d90fa9cb4 to your computer and use it in GitHub Desktop.
Add custom column to shop_order post type
<?php
function add_custom_column_to_shop_order( $columns ) {
$new_columns = is_array( $columns ) ? $columns : array();
$new_columns['software_key'] = __( 'WhatsApp' );
return $new_columns;
}
add_filter( 'manage_edit-shop_order_columns', 'add_custom_column_to_shop_order' );
function add_custom_column_value_to_shop_order( $column ) {
global $post;
if ( $column == 'software_key' ) {
echo $post->post_status;
}
}
add_action( 'manage_shop_order_posts_custom_column', 'add_custom_column_value_to_shop_order' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment