Display custom field value part by part?

Per comments just trim the $colors before use: if ( get_post_meta( get_the_ID(), ‘hex_colors’, true ) ){ $colors = get_post_meta( get_the_ID(), ‘hex_colors’, true ); $colors = explode( ‘ ‘ , trim( $colors ) ); foreach( $colors as $color ) { echo ‘<div>’, $color, ‘</div>’; } }

List all unique custom field values?

From what I understand I think you can try something like: SELECT meta_value, COUNT(post_id) as count FROM $wpdb->postmeta WHERE meta_key = ‘authors’ GROUP BY meta_value HAVING count >= 20 ORDER BY meta_value; Let me know if this works for you!

Creating custom post type with custom taxonomy and custom fields programatically

Create Custom Post Type function create_product() { $labels = array( ‘name’ => _x( ‘Product’, ‘post type general name’, ‘stacy’ ), ‘singular_name’ => _x( ‘product’, ‘post type singular name’, ‘stacy’ ), ‘menu_name’ => _x( ‘Products’, ‘admin menu’, ‘stacy’ ), ‘name_admin_bar’ => _x( ‘Product’, ‘add new on admin bar’, ‘stacy’ ), ‘add_new’ => _x( ‘Add New’, ‘product’, … Read more