It can be achieved using pre_get_posts.
It is important to prefix all your variable names, id seems not be in the reserved terms list, but anyway this practice avoids any unforeseen bug.
/**
* Usage:
* http://example.com/wp-admin/edit.php?my_pids=4088,4090,4092,4094
*/
add_filter( 'pre_get_posts', 'limit_post_list_wpse_96418' );
function limit_post_list_wpse_96418( $query )
{
// Don't run on frontend
if( !is_admin() )
return $query;
global $pagenow;
// Restrict to Edit page
if( 'edit.php' !== $pagenow )
return $query;
// Check for our filter
if( !isset( $_GET['my_pids'] ) )
return $query;
// Finally, filter
$limit_posts = explode( ',', $_GET['my_pids'] ); // Convert comma delimited to array
$query->set( 'post__in', $limit_posts );
return $query;
}
Related Posts:
- Plugin API for easy admin list table generation, handling & exporting of MySQL tables?
- How are bulk actions handled in custom list table classes?
- How do I create links at the top of WP_List_table?
- Using query_vars filter
- How-to implement admin Ajax inside an admin WP_List_Table?
- Create a clickable name in WP_List_Table for Plugin Admin
- Extending WP_List_Table seems getting wrong with $this->get_columns() – what’s wrong?
- Get a custom table to an array
- How to display additional info in the plugins admin table?
- how to make custom bulk actions for a WP_List_Table (core class)
- Problems with: manage_${post_type}_posts_columns
- $paged always 0 on plugin’s custom page
- How to show filters on table when using WP_List_Table
- Wp_list_table search box not working for custom value from database
- WordPress pre_get_posts with combined results of two queries (OR)
- wp_get_post_terms Order by not working
- Prevent WordPress automatically processing certain URL queries
- Why in this archive page that call query_posts() function show only the last 10 posts?
- insert query on a custom table using ajax with jQuery plugin Jeditable
- Taxonomy archive page listing terms instead of posts
- Brainstorm – Slow Query from Plugin Need to Speed It Up
- Checking for existing title in custom db query not working
- Load specific page when a custom URL is hit
- WP_List_Table Inside Metabox With Bulk Actions Not Working on Submit
- How to grab data after wp user search is complete
- WP_Query not ordering correctly
- Wp_List_Table is showing as no class found named wp list table
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- bindParam? WordPress 4.9.5 SQL LIKE statement %s and %LIKE%
- Different style for specific rows in custom list table using WP_List_Table
- WP Query Relations / Compare
- Array/List Edit in Backend
- Add query string variables to all hyperlinks URL matching a specified domain
- Extend WP_List_Table class – Edit wp_usermeta – WPPB.me Boilerplate – Action error
- Checking if the query is empty does not work
- Can I log the searches that are returning 404 in the DB?
- How do I create a custom role capability?
- What is the advantage of using wp_mail?
- Export data as CSV in back end with proper HTTP headers
- Calling the widget id of a mult-instance widget from inside the widget?
- Do I need to call do_action in my plugin?
- WooCommerce get Shipping Class of product from either the product id or the order after order is completed
- Dequeue script, but still use wp_localize_script to pass vars
- Can I add pages to my custom menu via script?
- Replacing WordPress menu functionality with a plugin
- Programmatically Selecting Theme Based on URL
- Why is print_r returning $classObj->userObj in several places on site
- Is it possible to load plugin from console with core ?
- Plugin development: is adding empty index.php files necessary?
- Plugin base URL
- Database for development
- Customize multisite site creation with user data
- Adding plugin settings link upon activation
- How to create multiple Gutenberg blocks in one plugin
- Buddypress function and global $bp question
- Custom plugin: Loop through taxonomy types and update columns for all types?
- How to add setting section in custom post type [closed]
- Get Current Menu Location inside Nav_Walker
- How to Display my HTML form in my Custom Plugin?
- Where to add hooks in a class
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- Incorporate small angular feature in my wordpress site
- Bootstrap doesn’t work on admin menu page-How to override wp-admin style?
- Use just a shortcode from another page
- How can I avoid conflicts between plugin and theme?
- How to control an elements classes from multiple Gutenberg sidebar controls?
- WordPress class, using add_action to call member function does not work
- random code at the end of file after plugin upload
- $wpdb->prepare with LIKE and sprintf
- Quasi-custom API Call Plugin
- How can I show posts for a single category?
- Show content without a post
- WP ajax requests not stacking?
- In wordpress plugin wp_signon shows error
- Is it possible to load the css just on my plugin admin page?
- Problem with autoloader and namespaces
- AJAX call returns ‘testtest0’ instead of ‘test’ – why?
- Get audio metadata on file upload
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- Loading Images from Javascript on the Front End
- How to deal with different jQuery versions?
- Can I attach a plugin via my add_filter callback contents?
- Custom payment method after payment user is logged out on thank you page
- The URL of images on my website changed after being set as featured image
- extraprops override existing props
- converting a node.js project into a wp plugin
- Is “document loaded” different on admin side than public side?
- how to handle premium features in a wordpress plugin?
- Unexpected issue when using attachment_fields_to_edit filter
- How Can I Update wp_enqueue_scripts () From WordPress Option Page Radio Buttons
- Load textdomain from global languages directory
- Tie specific functions to options-update for limiting API requests
- How to set custom homepage via a plugin
- add_rewrite_rule not working
- Options don’t save, validation callback not executed
- Add admin settings and options
- Developing a wordpress.com shortcode [closed]
- correct way to include an external HTML page in WP-admin
- Add custom CSS for plugin admin Page
- Theme / Divi change visitor css and site logo and all site urls based on REQUEST_URI non logged in wp user