CSV file header

You may want to considering using the WP Ultimate CSV Importer Plugin instead with this you can map the different fields in the CSV to the columns in wordpress (source: wordpress.org)

Function to get the name in database table from the comma separated string

Not tested but this should work: add_action(‘manage_pages_custom_column’, ‘display_page_custom_cols’, 10, 2); function display_page_custom_cols($col_name, $post_id) { global $wpdb; $user_group = $wpdb->get_results(“SELECT * From custom_user_group”,OBJECT_K); if (‘user_group’ == $col_name) { $pages = explode(‘,’,get_post($post_id)); $output = array(); foreach ($pages as $page ) { $output[] = $user_group[$page]->GroupName; } echo implode(‘,’,$output); } }

How to Import Multiple Values in custom field

The granularity of data in your example suggests that custom field (more so one with multiple values) would be wrong choice in first place. Think about it like this: only one dog might weight precisely 35.5kg — that is type of data appropriate for custom field multiple dogs (or dog breeds) might be of medium … Read more

WooCommerce – Adding Product Attributes to CSV Export

With the help of a more knowledgeable colleague, we got it working. Here’s the code: /** Add custom column headers **/ function wc_csv_export_modify_column_headers( $column_headers ) { $new_headers = array( ‘fund’ => ‘fund’, ‘appeal’ => ‘appeal_code’, ); return array_merge( $column_headers, $new_headers ); } add_filter( ‘wc_customer_order_csv_export_order_headers’, ‘wc_csv_export_modify_column_headers’ ); /** Set the data for each for custom columns … Read more

Creating connections programmatically with common fields on CPT’s

No need to code for this one as it was already solved by mikemanger with the plugin Batch Posts 2 Posts for, as the name says, batch creation of relations using Posts 2 Posts plugin framework. As in their description: This plugin makes it easy to create relations using the Posts 2 Posts plugin. For … Read more