$the_query->the_post(); is populating the global $post with each post in that loop. On front-end queries, you’d normally call wp_reset_postdata() after running a secondary query loop, but that doesn’t work on the admin side.
Use get_posts instead of WP_Query, and iterate over the results with a foreach loop-
$my_posts = get_posts( $args );
if( !empty( $my_posts ) ){
foreach( $my_posts as $my_post ){
echo $my_post->ID;
echo get_the_title( $my_post );
}
}
Related Posts:
- How to add meta box to plugin admin page?
- Add custom meta box on Post page
- Validation Function for URL in plugin
- Creating Custom Meta Boxes on Plugin Option Page
- How to attach Links into page/post or custom post type?
- Add custom buttons with custom actions in Edit Post screen in WordPress?
- Best Way to Remove WordPress Meta Box based on Post Status
- Plugin “Meta Box”: Implementing meta boxes in custom post type
- How WordPress autosave can save plugin fields?
- How can I filter the contents of a metafield before it’s displayed in the admin?
- Admin Dashboard with Custom Tab for Client
- Security checking in meta_box save is reluctant?
- Advanced Custom Fields
- RW Meta Box ,Problem setting post title
- dynamically generating plugin syntax
- Not able to complete meta box save function and sanitization/validation
- Correct way to make meta box with more than one meta field secure
- get_post_type on post.php
- All of my custom posttypes are 404’ing
- Save / Show multi line text in metabox
- PHP basics help in WP context – remove a class/function?
- How to remove plugin metaboxes from edit.php
- How can I make my metabox appear?
- How to inform the user that the save was not successful?
- Show meta box only when post is being published first time
- Retrieving Meta from Image Attachment
- WordPress metaboxes – textfield suggestion automatically populated
- Finding the screen id of a page generated with add_menu_page
- Date format – Meta Box plugin
- Meta Box by Rilwis, Load metabox on all page templates EXCEPT the homepage
- Adding custom meta boxes to specified custom post type
- Access post title from custom meta box on title change
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- add_meta_box creating default form field types
- Should meta boxes for specific pages be save in their own plugins?
- WordPress meta-box and checkbox-list
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Custom Meta box change size
- Preset custom fields
- submit two file input fields in the same form
- WordPress default post categories meta box widget
- How to get checkbox by default true in metabox?
- How to pass multiple custom fields as shortcode’s parameters
- CMB2 Output Select Box Chosen Option
- Add Cancel Button to a Custom Meta Box
- WordPress CPT Url metabox collection
- Add_Meta_box to custom page (formidable edit post)
- why my wordpress dont have toolbar like, plugin, themes and other?
- My own metabox checkbox plugin only saves the last value I’ve checked
- CMB2 Post Search Field displays/repeats initial post if left empty
- Do something with thumbnail image on post publish
- How can I remove this sidebar from my Search Results page?
- Add custom field for users
- Alter add_meta_box
- Displaying image from a repeatable group
- How to add jquery to my custom post type wp plugin
- How to get rid of error message of custom metabox in dashboard when moving out of edit page?
- Metabox Data not saving
- Custom plugin breaks css.php on Multisite
- Advanced Custom Field User Help URL
- Problem for recover and save metaboxes
- How can i do custom author list?
- Meta Box plugin image_advanced not showing up on frontend
- How to change data format in custom meta box field [closed]
- iframe not showing on frontend when using a CMB2 field
- Problems with file_exists() with metabox plugin in WordPress
- Meta box not displaying on the plugin page
- add_meta_box showing blank screen in my page
- Turn Off Auto Update for Single Plugin
- Why is “plugins_loaded” not called/fired?
- Any plugin out there that uses WP’s internal image uploader?
- Is it possible to have screenshots in any other section rather than the screenshots section?
- Dynamic HTML not displaying at respective place
- Should I global $wpdb outside of any of my plugin’s functions scope?
- merging an array to an existing array using add_filter
- Is there a reliable way to keep track of how long a WordPress theme has been active?
- Show price with Geo IP location
- How to get 1 or 2 specific posts on top of my wordpress blog?
- How to find a run away wordpress plugin causing performance problems
- Getting value from dymanic text variable into Contact Form 7
- className not populating in custom block
- How to export post 2 posts WordPress plugin data [closed]
- automatic plugin install availability: server configuration
- WP-DownloadManager – Query most download per week/month etc
- How do I combine a theme with a plugin
- How to add a WordPress Nonce for this form to avoid CSRF
- Function call in wordpress short code handler fails
- Passing PHP Variables to AJAX Loaded Pages
- Hooks to run after a core upgrade?
- Make custom post types using ACF
- Using id to show item
- WP Migrate DB Pro plugin cannot transfer Media files to remote server
- Custom Gallery plugin uploading to different dir, and post to page
- What is the correct entry point for capturing coverage data
- Redirect login url
- WordPress Overrides folder permissions in Cpanel
- Setting META tags such as description and title on programmatic post creation
- making users able to add their own products wp e-commerce [closed]
- Selling Downloadable Products [closed]
- WordPress Plugin translation not working EN To FR