$post->id
needs to be $post->ID
You can also use get_the_ID()
Since your calling setup_postdata()
you need to call wp_reset_postdata()
after your foreach loop.
You also need to echo the value of $options somewhere.
foreach( $myposts as $post ) : setup_postdata($post);
$options .= '<option>';
$options .= '<option value="'.$post->id.'">';
$options .= get_the_title();
$options .= '</option>';
echo $options;
endforeach;
Related Posts:
- How do I exclude a custom taxonomy from the post loop
- Display category posts grouped by taxonomy
- display posts with same taxonomy term
- Including all terms in wordpress tax_query
- Display one post from each term in a custom taxonomy [closed]
- wp_options table value
- Is it possible to sort the post based on a custom field?
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Group posts that matches a term in a loop
- Custom taxonomy template loop
- How to handle “the_terms” inside loop
- Modify main loop in taxonomy archive page
- All posts are still shown when adding category argument to query
- Operations with custom fields values in a loop
- echo current taxonomy id for this loop?
- How do I Use Multiple Loops with WP_Query?
- How to adjust code to refresh a dropdown box with tags that are active on filtered category listing
- How can marge these loop code?
- How do I display a list of posts under all hierarchical children of the current taxonomy?
- Posts in loop displaying all taxonomies
- WordPress Tag or Custom Taxonomy Return All Posts if has that Word in Post Title
- where is the 4th taxonomy terms? taxonomy terms is disaapearing in the loop
- Multi-select field for Taxonomy can’t save the value
- Display all posts that use a custom taxonomy
- If Custom Taxonomy
- How can I reduce amount of ifs and else ifs in this specific block of code?
- Returning One custom taxonomy term name
- Exclude taxonomy term from all loops, but having it on widget
- Using WP_Query and Query_post for the loop?
- Loop to display ONLY custom taxonomy parent information [closed]
- Loop through custom taxanomy in post and display custom fields from posts
- WordPress modify Settings > Permalinks (options-permalink.php) Add CPT Permalink Options
- List terms of custom taxonomy if matches other taxonomy
- Only display latest custom taxonomy post
- How to get the term description in a taxonomy term archive query?
- Chaining Taxonomy Queries
- Problem with sorting in custom child taxonomy archive page
- How to add a shortcode function that returns the taxonomy slug of the actual post within the loop
- Group posts in a category based on tags in custom taxonomy
- How to loop custom posts that have an exact match in taxonomy terms?
- Get post meta value outside of the loop
- ACF – Get unique values of array
- Remove Custom metabox from particular page template is used
- Adding a checkbox field to a (custom) taxonomy
- Custom taxonomy shows full articles
- Is it possible to sort the post based on a custom field?
- Output slugs to use as class names for every taxonomy a post is attached to
- Multi level archive
- List active taxonomy terms
- Dynamic value for get_option linked to taxonomy term_id?
- sort Posts by custom user filed
- How to get name of custom taxonomy
- Query pages by child term
- Query Number of Loaded Posts in Loop
- Trying to achieve row posts below category with multiple loops in custom tax
- Custom Taxonomy + JQuery Tabs
- WordPress show posts from children terms of a taxonomy term
- Loop custom post type by taxonomy (Category)
- Get custom taxonomy value of post and output posts in same taxonomy
- How do I create a term for every value of a post meta?
- How home my code doesn’t display any feature image? Looping through post from a taxonomy and not getting feature images back
- Loop posts without any taxonomy
- How to looping taxonomy terms?
- Adding Category/Tag/Taxonomy Support to Images/Media
- Large taxonomy (2000+ terms), causing WordPress to hang
- How to display warning on post editor when trying to add new term to custom taxonomy?
- Check if current term is a child of another term
- Is there a way to import terms into WordPress?
- Custom metabox for menu administration page?
- How to pass posts_per_page and paged params query vars to custom taxonomy archive urls?
- Exclude Custom Taxonomies
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- Get custom category name from ID
- Populating dropdown menu with hierarchical taxonomies
- Specifying a size when displaying an image associated with a taxonomy through ACF
- Display all posts for taxonomy term across multiple custom post types
- Getting Term ID from Term Name for WordPress Query
- How to join result of different taxonomies?
- wp_insert_term created and set for first once only
- Show all taxonomy’s terms’ posts having another taxonomy’s term in common
- Render P2P metabox per taxonomy term
- Adding content to custom taxonomy category pages
- Display formatted list of taxonomy terms with last seperator different
- Are term IDs unique even between multiple custom taxonomies
- Display a colour of custom taxonomy on the page
- Add attribute taxonomy through code don’t appear in admin product page
- Admin only taxonomies?
- new custom filed not showing in taxonomy
- Rewriting url for multiple Taxonomies and Custom Post Type
- Why is the category item count not updating after assigning a category?
- Dropdown (with onChange) with custom taxonomies
- How to get a terms and posts associated with another term?
- How to use two same taxonomy in same post differently?
- Custom taxonomy name not being translated in post manager page
- Can I use multi (sub) levels of relation (AND | OR) on custom query?
- Avoiding stripping of HTML in Custom Taxonomy Meta Field
- Looping taxonomy in taxonomy?
- Can I use get_term_children to show child terms if they exist and show something else if they don’t?
- Displaying the custom taxonomies side by side on the admin dashboard
- Hide empty categories on widget