You’ll need to run through get_posts() to apply the order by handling.
$planIDs = get_post_meta( $post->ID, '_lm_comm_plans', false );
foreach( get_posts( array( 'post__in' => $planIDs, 'orderby' => 'name', 'order' => 'ASC', 'post_type' => 'plans' ) ) as $plan ) {
$pdfID = get_post_meta( $planID, '_lm_plan_pdf', true );
$pdfURL = wp_get_attachment_url( $pdfID );
$planTitle = get_the_title( $planID );
?>
<li class="plan"><!-- content here --></li>
<?php
}
Related Posts:
- Sorting Grids with Essential Grid and Events Manger
- Can’t seem to do combined query AND sort?
- sort query results by newest
- Re-sort get_posts query results
- How to manage a particular “order by” for get_search_query()?
- How to rearrange a pool of posts joined using two queries?
- How to “orderby” the first array in a meta_query that uses multiply keys?
- Sort query_terms_list for post_tags alphabetically
- Order posts ascending from posts in array
- Orderby event date (if it exists) or post date (if it doesn’t) – how to reorder posts based on meta value OR date
- New custom post type entries are not sorted correctly in admin using pre_get_posts
- Sort loop with query in the link
- Ascending & descending posts on same page with IF statement
- How to Optimize WP site for millions of posts
- Get Terms by IDs with IDs order
- How to List Events by Year and Month Using Advanced Custom Fields?
- Is there any difference between hooks posts_where with posts_join and posts_search performance wise?
- How many WordPress SQL Queries per page?
- Slow wp_enqueue_media()
- Advanced Custom Fields – Query Efficiency
- How do I sort multiples pages?
- How to display lastest post date in the homepage?
- How to tell if $query_var isset?
- The use of including upgrade.php when building custom queries
- Get the timout value of a saved transient?
- Help with wordpress custom query and advanced custom fields plugin
- Does meta_query work within get_posts array?
- Mysql / WordPress killing my server with 80k users [closed]
- Query all posts and not repeat the same tag
- Slow meta_query with about 4 milion record on wp_postmeta
- How to show more than 5 posts?
- WordPress Find Duplicate Post By Content
- WP Query Sort by meta value (date)
- mySQL query. ORDER BY meta_key
- how to query multiple categories in wordpress?
- Disable the MySQL query in the main query
- Strange string in console from wpdb query
- Update slug (URL) of pending posts via phpMyAdmin
- Insert static element only once in query archive
- How to run a mysql query when admin updates user role?
- How can I get the query that would be run for the archive page?
- Query metas (and not : query posts by metas)
- Select query for a login
- What’s wrong with my $wpdb prepare?
- where should I reset query after using get_results?
- Exclude featured image and custom field from this get_attachment query
- How is it possible to get top comment from all children?
- wpdb print all post meta
- Form and custom query problem
- Export Specific User data without plugin
- I want to create a filter for the query string is this possible?
- How to write: $wpdb->update having WHERE NOT value pair in the array
- Exclude all sticky posts front page twenty twelve
- wpdb COALESCE won’t work
- get csv of users with user_meta
- Custom SQL Query passing array to WHERE p.id
- Restrict query to last day with posts
- Query does not return content
- Query posts dynamic date range
- Parse query filter in wordpress and relation
- get posts by tag to showing in a widget
- Mysql query not working on WordPress 4.2.2
- get_post_meta with WP_query
- Taxonomy filter under Polylang
- List WordPress Post and Related Attachments outside of a post page
- How properly create a blog template for wordpress?
- Is there a way to add a link directly into this media query?
- create a link to a random post within the current category
- Problem on displaying the results on my query
- Improve performance of slow query
- WordPress search in modified post title
- meta_query not working
- Cannot get sql request from Query object?
- WordPress query: merge meta key (number) values and sort
- Question about of query
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Modify behaviour of “s” parameter in wp_query
- Sort by postmeta on when searching
- Pulling an ACF into a query
- How to make MySQL search queries with quotes
- Limiting a filtered query
- Using cron for multiple queries
- Archive query not working correctly
- Custom MySQL Query for Post and Post Meta
- Displaying popular posts
- Set posts per page for parent category and it’s all children
- Exclude sticky posts from query
- How to have more post in a page than in your home page
- Find all posts via SQL beginning with A of type B
- learn to run wpdb class
- Display old posts if no future posts exist
- Access Tables with number prefix
- If more than 1 image show post link?
- Rewrite Query_Var URL Parameter with Slug
- How to query different categories on index?
- How to specify what kind of is_single post?
- Can’t See Media Queries with Inspect Tool [closed]
- Print data from wordpress sql query
- Can I create my own query in wordpress with traditional methods?
- How to show sticky posts on all pages of the pagination, not just the first page?