Last active
April 10, 2019 01:49
-
-
Save filipecsweb/0669ae7afe20abffab0c to your computer and use it in GitHub Desktop.
Add custom value to custom column in shop_order post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add custom value to custom column in admin on page that lists the shop_order post type. | |
* | |
* @param string $column This is the column id/key. | |
*/ | |
function add_custom_column_value_to_shop_order( $column ) { | |
global $post; | |
if ( $column == 'software_key' ) { | |
echo null !== get_post_meta( $post->ID, 'software_key' ) ? get_post_meta( $post->ID, 'software_key', true ) : '-'; | |
} | |
} | |
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