Use wp_reset_postdata();
to restore the global $post variable of the main query loop after a secondary query loop using new WP_Query. It restores the $post variable to the current post in the main query.
call wp_reset_postdata();
after endwhile;
<?php while($org->have_posts()) : $org->the_post(); ?>
<option value="<?php echo $post->post_name; ?>"><?php the_title(); ?></option>
<?php endwhile;
// reset main query
wp_reset_postdata(); ?>
Related Posts:
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- Adding an extra parameter [string] to my posts’ permalink?
- One Custom Post Type two different Templates
- Metabox messes up permalink
- How to retrieve custom post type permalink in another cpt?
- Custom post type – permalink
- Permalinks: custom post type -> custom taxonomy -> post
- Mixing custom post type and taxonomy rewrite structures?
- Resolve a custom post type name vs. page permalink conflict (same slug)
- How to change permalink structure for custom post type and it’s taxonomies?
- Change permalinks for posts but not for custom post types
- Custom post type permalink: only use %post_id% and remove %postname%
- 404 on child page when parent page slug is identical to custom post type
- rewrite get parameter with custom post type
- Custom permalinks – post type – hierarchical taxonomy’s
- Change permalink structure for custom post type
- add_meta_box: Datepicker like the one for postdate?
- Custom Post Type Meta Boxes
- Custom post types and permalinks : What a mess !
- Custom Taxonomy breaking pages permalinks
- Custom post types and permalinks
- Custom post type – how can I make it a sub-url of another page?
- Custom fields in Permalinks?
- Dynamically add / duplicate custom meta in custom post types
- Change URL of posts and also Custom Post Type
- How can I create a custom meta box to add an mp4 video to a page?
- Pull a post based on a meta value in a custom post type
- Custom post type permalinks
- Use different taxonomies in different custom post types’ permalinks?
- Change meta box when the page’s template is changed
- post_type_link not working in gutenberg
- Cannot save Checkbox meta box value from a Custom Post Type
- Custom template won’t load for a custom post type (custom permalinks used)
- How can I update the permalink everywhere for a custom post type?
- Help with Elementor Pagination CPT archive 404 problem
- How to have the same url structure for both a CPT and a Taxonomy?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- Can’t remove front from permalinks for custom taxonomy category page
- Metabox not show in categories custom post type cmb2
- Custom Permalinks with CPT and Hierarchical Taxonomies
- pre_get_posts for custom page builder meta box
- Blog posts for custom post type only
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Custom post type permalink returns 404
- Using POST method in meta box, no results
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- 404 in custom post type feed with mistake permalink
- Add a permalink variable onto custom post type URL after post name slug
- How to solve this custom post type goes to 404 page?
- Save Multiple Metabox values
- How to query 2 custom post types that need to share a slug?
- How to change path for default WordPress blog posts?
- Create metaboxes based on custom post type
- Custom post type as child of page
- How to Echo Metadata Value in Currency Format
- populate array with posts
- How to implement a different permalink structure for custom post type?
- Custom Post Type permalink without /%day%/ and/or /%postname%/
- CMB2 metabox create select with list of post from CPT
- Meta box data is saved but NOT displayed in the meta box text field. Why?
- Enabling permalinks disables custom page template
- I can’t connect my custom jquery to wp admin
- Saving meta box data?
- Invalid file type when using wp_upload_bits to upload PDF to a custom post type
- Metabox does not show in custom post type
- Include a metabox in the ‘home’ screen of a custom post type? If not, then the dashboard page?
- Adding /blog in front of single posts (only)
- How to remove /blog/ prefix for custom post types in permalinks?
- On saving Post My permalink is updated and category is removed automatically which cause the 404
- Edit the default ‘post’ custom post type arguments
- add all blog posts to folder
- Category permalinks don’t work even after flushing
- Changing permalink of default Post with custom post
- Custom Taxonomy Archive generates 404
- Custom metabox with image gallery upload that won’t attach images to post
- Enabling hierarchical in a Custom Post Type gives error 404
- Standard Page Child of CPT Not Found (404)
- Wp Query sort order from custom MetaBox
- How to create a permalink structure with custom taxonomies and custom post types
- Permalinks change when edit published post on custom post type
- Custom permalink rewrite rules – how do I fix this?
- Associate custom CPT with another CPT’s taxonomy and rewrite permalinks
- Post Custom & Taxonomy 404 error
- Same permalink structure for all post types?
- How to add a custom meta box below publish box in CPT that is like publish meta box and can contains html?
- Custom post type with parent page? Possible?
- Hierarchical taxonomy in permalink structure
- Search form to find custom meta box generated data
- Yearly Archive from a custom date metabox (Event Start Date)
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- “regular” pages not found after changing permalink
- Custom Post Type and Taxonomy pagination permalink
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Custom post type permalink structure
- How do I use CPT and permalinks with a mobile theme?
- CPT Template Option to Top
- Use a Variable in update_post_meta as the $meta_key
- Can I have a specific template for products even if they are standard posts and not CPT?
- How to add custom permalink struct with DYNAMIC author to a Custom Post Type
- Permalinks for Custom Post Types and Taxonomies