This is just a basic php array question – not a WP question.
function unique_authors ( $authors ) {
$newArray = array();
foreach( $authors as $item ) {
$itemArray = explode( ", ", $item );
$newArray = array_merge($newArray, $itemArray);
}
$newArray = array_unique($newArray);
return $newArray;
}
$authors = unique_authors( $authors );
foreach( $authors as $author ): //etc
Related Posts:
- How to wrap meta values seperated by comma in ? [closed]
- Run a check for multiple meta key values
- IF Custom field value equals ZERO
- Update post meta custom field using block editor
- Set class if a meta value is set within post archive
- Custom Field: Display only if a specific key is selected outside the loop
- WP Query Args – search by meta_key or title
- Saving multiple custom meta box fields
- get Custom field label (select/dropdown) on front end
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Custom post meta field effect on the performance on the post
- Difference between meta keys with _ and without _ [duplicate]
- Orderby meta_value only returns posts that have existing meta_key
- What is “meta_input” parameter in wp_insert_post() used for?
- How to enable revisions for post meta data?
- Can I count the number of users matching a value in a multiple value key?
- Auto sort the wp-admin post list by a meta key
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- Is there a hook / action that is triggered when adding or removing a post thumbnail?
- passing argument to get_template_part() or a better way to code
- Get updated meta data after save_post hook
- Order by custom field date with ASC order
- Create meta boxes that don’t show in custom fields
- Ordering posts by anniversary using only day and month
- ajax delete value from custom field array
- Save attachment custom fields on front end
- How to use pagination with get_post_meta
- WP_query : meta_key with custom rule for specific value
- Custom fields: In what order are they saved into the DB?
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How to display Meta Field Value?
- MySQL query to set wp_postmeta using term_taxonomy_id value
- How to Validate Post Meta type/extension (Video File Image File etc)
- Custom Meta Box not Saving in Posts with Gutenberg Editor
- Combine multiple custom field values into single value
- How do I use wp_query for WordPress search?
- Nav Menu – Add class based on meta keys
- Bulk remove post meta
- How to create html block to display extra information on woocommerce single product page
- Can’t get post ID using wp_insert_post_data
- How to create a Custom Meta Box with Name/Value Admin User Input Fields?
- WordPress Rest API to call page data associate with custom meta
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Hide custom meta data if empty
- What WordPress function to use to get meta value by using meta keys?
- How to create a shortcode to print specific values stored in a post meta array?
- Removing link ” from ” on meta_value in custom feilds
- Add custom field to all posts in specific post_type
- Button inside Custom Meta Box triggering the Update Button
- How to load an assets based on custom field value?
- Custom WP_Query for WordPress Search Results with meta_query
- How can you include custom post meta in search without calling each key?
- Can I access a post meta field before the loop?
- wrap text around custom fields array
- Get all the posts where meta field with multiple choice has several values checked
- wordpress custom loop ascending descending posts by custom field
- How to validate select field in post meta?
- How to display childrens custom fields?
- Hide custom fields when empty
- List custom field values in alphabetical order without repetition
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- Save all the post tags inside a custom field
- How to update a custom field in all posts with the value of another custom field in the same post?
- How add multiple wp_editor_box to new post
- Get custom fields without _edit_last, _edit_lock, _wp_page_template and _visual-subtitle
- query_posts with meta_value
- Get YouTube video id from url in a custom field
- Related query shows same image in loop
- Why am I getting a “Call to member function format() on a non-object” error?
- Can’t Output get_post_meta?
- put saved metabox values back into fields and then display on the front end
- Modify custom field from front end
- How to get custom image field of specific post id
- Custom Query: query by post custom meta data
- get_post_custom_values problem, please help
- update_post_meta not working well
- How can I change author of posts to the value of one of the custom field of the posts?
- User query – getting values for custom meta keys/fields
- get posts based on non-single metadata
- Custom meta fields and meta keys
- How to add a post’s view count into the WordPress API response
- Can’t set custom meta fields for a post
- Saving Custom Field that includes Quotation marks
- Post meta data not showing in frontend, until hitting ‘update’ button
- Query Posts based on custom field value
- Echo out custom fields in comments
- Display Data From This Custom Media Upload Meta Box?
- Sorting Posts with meta value not working
- Query postmeta values, and return multiple post_titles for common meta value
- When post is updated, custom metadata in text area field is overwritten
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- update_post_meta not working in action hook
- When editing a post with a custom meta box the values aren’t displaying correctly
- Hard Define Custom Field Value
- add_post_meta insert null value into Database
- How do i output images from URL’s added to the same custom field key
- Retrieving custom field as shortcode
- add multiple values (array) to post meta_input
- Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)