You could do a custom SQL query:
global $wpdb;
$query = "SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'director' ORDER BY meta_value;";
$directors = $wpdb->get_results( $query );
foreach( $directors as $director ) :
echo $director->meta_value;
endforeach;
one thing to note here though is that since you’re not querying the associated posts, you could get values that belong to unpublished posts, if that’s a concern.
Related Posts:
- 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?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Max length of meta_value
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- get_pages sort alphabetically by meta value
- Assign/update the custom field value for all posts
- Order by custom field date with ASC order
- How to break meta values into different items and avoid duplicates?
- WP_query : meta_key with custom rule for specific value
- How to sort category by custom field value
- trim custom field text value and show (…)
- Query post order by post and desc not working
- How to wrap meta values seperated by comma in ? [closed]
- How to create a Custom Meta Box with Name/Value Admin User Input Fields?
- Run a check for multiple meta key values
- Filter by custom field (meta_key) using JSON API
- Removing link ” from ” on meta_value in custom feilds
- Sort alphabetically by custom field
- pre_get_posts : only get posts by wp_usermeta value
- meta_value and meta_key filtering returning no posts [closed]
- IF Custom field value equals ZERO
- How to update a custom field in all posts with the value of another custom field in the same post?
- Update post meta custom field using block editor
- How to add custom filed value after in wp post title
- Sortable Custom Columns not sorting correct
- query_posts with meta_value
- Show array of meta_value in Edit Post Coloum
- Making WP_Query limit results by date before today where date is a meta_query
- User query – getting values for custom meta keys/fields
- get posts based on non-single metadata
- Best way to insert a list of links into a post outside of the_content
- Set class if a meta value is set within post archive
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- How to get all wp_posts in wordpress fetched from database
- Create Shortcode shows only posts with custom_field meta
- 4 Unique Random Posts based on Custom Field Values
- Custom Field: Display only if a specific key is selected outside the loop
- Insert shortcode before and after a list automatically
- How can I display only the post titles from a selected category in columns?
- Foreach giving one too many list items, how can I remove the last empty line?
- WP Query Args – search by meta_key or title
- Saving multiple custom meta box fields
- get Custom field label (select/dropdown) on front end
- Can I count every article following extracted meta value?
- Best Practice for storing aggregate data by date or other criteria?
- 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?
- Custom field/meta populated by dropdown of existing posts?
- What is the index [0] for on post meta fields?
- Pass all custom fields through the same filter on post load?
- Add custom fields when specific templates are selected
- Save custom user meta on registration
- How to hide meta box values from custom fields list?
- update_user_meta: How many is too many?
- Search ONLY by meta key / meta values
- Using media-upload.php to upload mp3 via custom fields
- Correct Approach for Validating Custom Field Input
- Meta keywords and descriptions plugin for manually editing meta for each page/post
- Query meta field using between
- How to add/save Custom Field in user settings/profile “Checkbox list”
- How to add dynamically the main parent pages’s custom fields and their values to all sub-pages?
- Delete post based on a custom field?
- How to make custom comment fields required and message field not required
- Display info from custom fields in all images’ HTML
- Update meta values with AJAX
- How can I migrate all of my custom field thumbnails to the built-in post featured image?
- Multiplile values checkbox or select in custom meta box
- How to use query_posts() with a date filter on a custom field?
- Login & Register & Custom details WITHOUT plugin
- Compare WP Custom Field date
- Escaping Quotes
- Deleted pages showing up when querying for child pages
- wp_editor removes paragraph from custom meta box
- Any way to include custom fields in WP_Query results?
- Ordering posts by date custom field
- Update posts after populating ACF field value [closed]
- Using a checklist to search against metadata
- Adding custom fields (post meta) before/during wp_insert_post()
- Where did the Add New Custom Field go?
- Sorting WordPress Posts via Custom Field Values?
- Admin meta Image Path
- Custom field as meta description
- post meta getting deleted on save
- Auto Populate Custom Field with Complex Value That Increase by One?
- Display custom field if it exists and has a specific value [closed]
- Checkboxes in registration form
- Syntax highligting for custom fields
- Displaying a checkbox array from advanced custom field
- Display custom field values from posts on frontpage
- WordPress: custom field display twice
- meta_compare seems to be treating values as strings instead of integers as expected
- Is there any way to get all meta and standard columns for any WordPress object after searching based on meta key and value
- How to add fetchpriority parameter to images in the media library?
- Calling the “wp-link-wrap” pop-up modal
- Editable custom field in WP Admin Dashboard
- How do I add an image upload, custom field to a WooCommerce product?
- Customizing user data
- displaying and sorting comments by a custom field (using PODS plugin) [closed]
- Trying to sort and display categories(not posts) by custom field: ‘order’
- Custom tables or custom fields?