I’m assuming there is an option in the array that is meant to receive an array of options for the checkboxes…?
In which case, you can use get_posts
to obtain an array of post objects (of which ever type), and then loop through this, to create an array of post titles:
For example..
$args=array('numberposts'=>-1,'post_type' => 'location');
$post_objs = get_posts($args);
$options=array();
foreach($post_objs as $post_obj):
$options[]=$post_obj->post_title;
endforeach;
You then have an array of location names, $options
which you can feed into your metabox array.
Disclaimer: I’ve not tested this code.
Related Posts:
- Very slow query
- Does meta_query work within get_posts array?
- How to show more than 5 posts?
- How to optimize my query filtering out unwanted data?
- Remove posts from query for events whose start date has passed
- get_posts() loop returns the same the_title() for each post
- List all posts from past week grouped by sub-category
- Order posts by custom field DATE value
- How do I see the mysql query generated by get_posts( $args )?
- Create Indexes for Slow Queries
- get_posts showing only 5 posts. (nopaging and posts_per_page -1 not working)
- pre saved posts query from db options table
- $post->ID not working in combination with a custom query
- Re-sort get_posts query results
- How can I get posts by 2 meta keys, prioritising one of them?
- Category_in return empty
- Sort order in get_posts [closed]
- Get the ID of the latest post
- Get all image from single page using this query
- How to Use Wildcards in $wpdb Queries Using $wpdb->get_results & $wpdb->prepare?
- Add multiple value to a query variable in WordPress
- wp_dropdown_categories with multiple select
- How to tune search argument in WP_Query to show only exactly the same results?
- How to get my loop to pull posts into three columns
- Custom $wpdb Query for Custom Post Type by Category
- Limit number of pages in pagination
- Can’t pass table to $wpdb->prepare
- How to extract all ID variables from a query string?
- Date query year and month OR just year
- Are database queries created using WordPress filters protected from SQL injection?
- get post id using the $query_vars variable
- Remove Unnecessary Mysql Query
- Grouping related postmeta data via SQL query
- Is there a conditional tag for latest post or do i need a query?
- How to check current user in meta value array in WP_Query meta_query
- Using pre_get_posts to target a query in the sidebar
- How select a specific query when setting offset?
- Change media attachment author via mysql query
- How do I use get_query_var() within plguin code
- Temporarily storing main search result
- Help with MySQL to $WPDB query
- Ordering by a metadata subfield in WordPress?
- sql select query in wordpress ‘page’ [closed]
- wpdb->term_taxonomy count posts from both published and private posts?
- Issue with using add_rewrite_rule() for post querying custom fields
- Group custom post listing in admin section
- problem with sql query in wordpress plugin
- Attempt to improve WP search, can someone check my SQL query?
- WordPress Query orderby title with UTF8 string in title
- Searching With Apostrophe
- How to get posts and comments amount per hour, per year and per month?
- List author’s posts with SQL
- Where is the query in wp-login.php
- Order posts by recent comments
- query if page has not child
- Order by title – but now built in wordpress func, sort the_title
- populate array with posts
- Display posts between two particular dates
- Order posts by date, but also give priority for a specific term
- Custom Query returns array, but I can’t see it’s elements
- How to insert Collate into WordPress search query?
- Combine “Exclude” Query in functions.php
- Related Posts function not working
- Optimize slow SQL query for multiple meta values
- prepare function sql safe method
- how to replace old DW site with new WP site? [closed]
- Wrap/close ‘query’ for a first-letter ordered listing of posts
- wpdb query with dynamic column name?
- How do you display the number of a post in a query?
- Order terms by count – missing terms
- How to return count of custom post type posts with a specific custom field value via $wpdb?
- How can I get the name of term post meta value which equals term id
- Help with Related Posts Function
- Trying to use WP_Query to return post with and without meta values
- Custom query Custom-Post-Types creates error
- Formatting a date/time returned from a custom $wpdb query
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Rewrite rule for query params
- meta_query not working
- Hook into the Admin Dashboard and redirect users
- WordPress query: merge meta key (number) values and sort
- Displaying data from custom table
- SEO friendly query vars
- Question about of query
- Prevent versioning for .woff (font) files
- How to get meta key list efficiently?
- Orderby event date (if it exists) or post date (if it doesn’t) – how to reorder posts based on meta value OR date
- OR condition not working
- Query by meta value (add a dropdown of all values)
- Query not returning child posts for any parent post ID
- Use $wpdb->get_results with filter based on array
- Add Hook for clearing transient when post is added
- Ordering Posts by parent category, name ascending
- Show links to child pages on both parent AND child pages
- learn to run wpdb class
- Modify Global Posts Plugin
- How to reference same column name but different table in custom db query
- Retrieving custom field array value through db query
- SQL Query : how copy all tags of post into their post content in wordpress by sql query
- How to show sticky posts on all pages of the pagination, not just the first page?