I am not sure if I get your question right, and thus don’t know if this answer goes into the right direction… Is this what you’re trying to achive?
$apart_locations = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta AS wppm
LEFT JOIN $wpdb->posts AS wpp ON wppm.post_id = wpp.ID
WHERE wppm.meta_key = 'postal_location' AND wpp.post_status="publish"
ORDER BY wppm.meta_value ASC" );
Related Posts:
- How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
- Can’t publish custom post type – “You are not allowed to edit this post.”
- Get_post_custom not fetching value from array wordpress
- Limiting the Number of User Posts to Their Own Posts
- Disable Facebook Comments Automatically On CPT
- How to create content automatically when a post is published?
- Custom Post Type meta value is being saved in array, instead of just the string (as value)
- Advanced search form with filters for custom taxonomies and custom fields
- Meta query with boolean true/false value
- How to get all children and grandchildren of a hierarchical custom post type?
- Custom field values deleted when trashing custom post type
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- How to get all custom fields of any post type
- Update CPT meta data using REST API
- How do I remove all the metaboxes for a custom post type?
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Gutenberg how to make attribute to save to meta
- WordPress Admin Panel search posts with custom post meta values along with title
- How to Update post status using meta data in Custom post TYpe
- Rest Api v2 orderby meta_key in custom post type
- bulk Update post_meta with default values
- wp_publish_post breaks permalinks
- post__in not taking my list of IDs
- Posts created in a Custom Post Type are lost if published without a title
- Add Post Url to Manage Edit Screen
- Registration and Custom Post Types – How to synchronize information?
- Display all custom post type posts and order them by an optional meta_key
- How can I get_post_meta() in the most efficient way?
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- Custom Post Status Transition Issues With Get Post Meta
- List all images from a single post meta value
- Show the same Article Available in Other Categories
- how to delete all users and posts based on ‘user_meta’?
- Meta Key Value in current-user-only loop
- How to set YouTube video as featured image?
- How to implement a Google map store locator
- Widget: Custom Post Type Post Listing Dropdown on Admin Side
- Update Post Meta for a logged in user
- How to duplicate entire custom post type
- get_post_meta not working on publishing
- get_post_meta returning no value in custom post type alert email
- Query Multiple Custom Posts by Custom Fields
- How to get the intersection of two terms both from different custom taxonomies
- Getting thumbnails of a custom posts featured images in a page-templates metabox
- Remove Post Custom Meta Box
- Using preg_replace to filter custom textarea
- Do posts, pages and / or custom post type objects have unique ID numbers or can there be multiple objects with the same IDs?
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- Archieve.php not loading for custom post type
- Meta data (Tags and Categories) for Custom Posts not showing.
- Display different information of a custom post type
- Create Array from custom post type to display a slider
- How to get specific post meta by title or id
- Custom Meta Box Causing Error: “Are you sure you want to do this? Please try again.”
- How to Make infinite loop of post
- get_posts seems to be skipping the last Post
- How can I display a drop-down select of Post Names
- $post->post_meta not pulling any post in wordpress/php
- WP_Query of custom post type sorted by meta_key has unexpected results
- copy images from custom field to another custom field
- Cannot obtain custom meta information
- meta query not retrieving posts
- Save Metabox Custom Field Value
- delete duplicate meta_value with same post_id
- Search CPT Title AND Meta
- Empty meta-box returns publishdate if no value is set?
- Building tags and archive using meta from custom post type
- Filter search posts by post meta?
- Custom Meta Box with variable number of fields
- date_query empty results with custom post type
- get_posts() returns empty on custom post type /wp-admin/edit.php
- Using publish_{custom-post-type} hook for custom post type to update meta doesn’t work
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Attaching more than 1 parent (Post) to a media file
- How to return/export only data showing on screen in custom post type view all screen
- Use WP_query to match post types based on custom field values
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- How to get post by meta value
- Get meta values from parent post and save in child post
- How do I get all authors posts of a custom post type outside loop
- Stored meta from attachment, video length?
- Custom post type meta fields missing on save_post_type
- Order posts by meta value hiding posts instead of re-ordering
- custom search results – order results differently by post type
- ACF saving posts
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- How to get post meta for custom post type and taxonomy
- get_post_meta for Custom Post Type ( CPT )
- Help ordering custom query by Title, Ascending
- This wp_query will not return any posts and only seems to work with post_status inherit?
- Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
- Fetch posts list from fist CPT taxonomy term and list under 2. CPT
- Updating User Meta from Custom Post Field Upon Publish Not Working
- Return only custom post types for the page, not all
- Create action running on trashed_post hook to modify post_meta value
- Random meta field from specific custom post type
- Custom Form Data save after Login User
- show custom post’s post in two different divs [duplicate]
- Emailing Authors only when a CUSTOM POST TYPE post is published- not when edited later [duplicate]
- Post Meta for Custom Post Types