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
- Block Editor – Meta values not saved, meta changes to empty array on update
- Can I exclude a post by meta key using pre_get_posts function?
- What is the index [0] for on post meta fields?
- Best way to programmatically remove a category/term from a post
- Custom field metabox not showing in back-end
- So much data in postmeta
- How to hide meta box values from custom fields list?
- get_post_meta() unserialize issue – returns boolean(false)
- What is the advantage of the wp_options design pattern?
- display specific custom fields
- Meta keywords and descriptions plugin for manually editing meta for each page/post
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- Transients vs CRON +Custom Fields: Caching Data Per Post
- Unable to save datetime custom meta field using update_post_meta() function
- Up/Down voting system for WordPress
- post meta data clearing on autosave
- Create custom field on post draft or publish?
- Display info from custom fields in all images’ HTML
- get_post_meta fields don’t show up on posts page
- Update meta values with AJAX
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- Add a post meta key and value only if it does not exist on the post
- Order posts according to user defined order for meta values?
- Custom fields to save multiple values
- Function to change meta value in database for each post
- Get aggregate list of all custom fields for entire blog
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- How to sort category by custom field value
- trim custom field text value and show (…)
- using multiple meta_key and meta_value in query_posts
- Adding custom fields (post meta) before/during wp_insert_post()
- Get specific custom field keys from a post and put into an array
- MySQL Query that looks for post with Custom Field, then changes Category
- ACF: How to get the full field name (meta_key) by a field key?
- post meta getting deleted on save
- filtering custom post types via meta data drop down
- How to add a new meta key and assign timestamp to posts
- If meta key exists in get posts function otherwise create it
- Filter by custom field (meta_key) using JSON API
- Custom field not updating when value is empty
- meta_compare seems to be treating values as strings instead of integers as expected
- Limit the number of acf content when displaying in post loop [closed]
- Read / Watch / Listen times – meta
- How to add custom metadata text box dropdown to sidebar in Gutenberg editor for all post types
- How do I Implement Atomic Update of Post Metadata?
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- Why is my Custom Meta Box Field Inputs NOT saving?
- Get registered custom fields or post meta even if empty
- Displaying multiple URLs as custom field values
- Show values of custom post meta on ‘Add new post’ page?
- Custom post meta field effect on the performance on the post
- How can you include custom post meta in search without calling each key?
- shortcode in a custom metabox
- How can I modify RSS item titles to be either the title or a custom meta field?
- Avoiding ACF get_field and returning to core WordPress function
- Problem with saving large amount of data in postmeta/usermeta
- How to get posts with a metadata numeric key greater than X?
- Get all the posts where meta field with multiple choice has several values checked
- Move Title and the Content WYSIWYG editor position
- meta_value and meta_key filtering returning no posts [closed]
- List custom field values in alphabetical order without repetition
- How do i get the attached images with custom value checked?
- Display posts with empty custom field
- Why am I getting a “Call to member function format() on a non-object” error?
- If metabox has content display content
- updating one custom meta field only
- Modify custom field from front end
- Footnotes in custom fields
- Create a new custom field for all posts based on current custom field
- Display Meta Data with HTML?
- wordpress get_post_meta / the_meta to output custom field value
- Group Posts By Custom Meta Value: Date
- Meta field bulk editing no longer working in WP 6.0 [closed]
- How to add a post’s view count into the WordPress API response
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- Allow HTML in Custom Metabox area
- Custom field metabox not showing in back-end
- Save, update, get and sanitize post meta as HTML not plain
- Saved Post Meta Array Returns as String
- Query Multiple meta
- Problem saving meta data
- change attachment custom field onChange event
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- Make Custom Fields Public in JSON – API
- Retrieving custom field as shortcode
- Order by a meta field in query loop
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Search for meta_query does not return any result if combined with title
- Can I count every article following extracted meta value?
- What is the best way to get a different post’s custom field/postmeta with js?