Few days ago I wrote a quick solution using pre_get_posts filter to hide some pages in admin area.
Maybe you could use it as a good starting point for whatever you’d like to achieve.
if ( is_admin() ) add_filter('pre_get_posts', 'mau_filter_admin_pages');
function mau_filter_admin_pages($query) {
$query->set('post__not_in', array(1,2,3) );
// Do not display posts with IDs 1, 2 and 3 in the admin area.
return $query;
}
But be careful: pre_get_posts affects almost all post queries on your site. You will have to use some conditions to make it work only where desired. if (is_admin()) was enough for me, but like I said it was quick solution and I haven’t tested it properly yet.
Im sure some local wp ninja will correct this if it’s too dirty .)
Related Posts:
- Build A Custom SQL Query for WordPress Search
- How to order posts by modified date without using ‘query_posts’?
- my function doesn’t return my post from today
- Automatically generate Post/Page from searched Database item?
- Exclude posts from homepage having a specified tag
- Get stock by custom meta field on all Woocommerce variable products
- Displaying the last post on static homepage
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Counting Search results, and displaying the offset per page
- WordPress query undefined offset in loop
- PHP -> SQL Query with Summing
- Why my query does not run with prepare
- Saving a post ID to use in a form elsewhere on website
- mySQL queries are executed twice on wordpress website
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Advanced Query posts
- My Custom Post Type AJAX Query is Returning no posts – why?
- WordPress Custom Form – Getting Query Vars, Weird Glitch?
- Display articles with a different template in the home page | Solved |
- WordPress sorting posts by date and title using a dropdown
- Is there anyway I can call the year once?
- Let user select the number of posts shown per page jquery error
- Getting error in sql query
- Pagination in WP Queries
- Get posts associated with media attachment
- Automatically create a loop for post ID
- Does wp_query and query_posts affect website performance? [duplicate]
- How to modify this function to exclude also the post belonging to a specific category?
- SQL query to retrieve the number of WordPress posts with all given categories
- Category Attachment Pagination 404 Error on 2nd Page
- Disable Attachment Pages Completely
- Inject post (from specific category) between posts in Loop
- Getting movie and serial on actor page
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- Handling an Ajax form submit
- WP database error for comments_popup_link()
- How to add a post or page tag to the list of classes appearing in the body tag’s class attribute?
- Get ID of child from child slug, while knowing parent ID
- Insert all post IDs in new database table
- How to display posts of specific category using a custom Query in WordPress?
- Renaming post IDs – Okay to do?
- List User order by ID in Descending order (Backend)
- Hide post if matches current month and year
- Why is variable not working on custom sql query using wpdb?
- How Display Posts on category
- Custom filter in admin edit custom post type responding with invalid post type?
- Sort query_posts for Parent Pages to menue order or the count?
- Increase offset while looping
- Two queries for a WP_User_Query search work perfectly apart, but not together
- remove post that has no content
- How to show only subcategories in parent category not parent category?
- WP Insert Post and then go to post
- WordPress website loads more posts than expected
- How to overwrite orderby with add_query_var
- Get latest post from all categories except one
- Parse error: syntax error, unexpected end of file
- Load Posts on Click via Ajax into a DIV
- How to Update post_modified of all wordpress post
- Lost in trying to create user database system
- create front-end users post list by specific category
- Posts are not looping through correctly
- Error display post thumbnails for previous and next post
- Querying for specific tags
- Limit tags shown in post
- form $_post action value gets truncated after it passes through two forms
- How to echo the_title from an array of posts?
- making php value numeric
- Using color schemes with Color Picker
- Wp Query : Order by distance lat,lon
- get value from get_post_meta then reuse it in another get_post_meta
- WordPress Post Block Element not properly parsed with the_content filter
- get different meta-data of a complicated query at the same time
- How to run complex query using PHP
- Storing huge number of users in wordpress
- How to Send Pingbacks for all Posts in WordPress?
- How can I check if a post with a particular slug or title exists?
- Reading URL Parameters
- Creating multiple tables with Plugin
- Custom User registration system
- How to use Multi SQL Database in WordPress?
- Category Page Displaying all Pages
- Trying to get post ID outside loop on blog page
- Enqueue script only on child pages of custom post types
- Attach and retrive multiple pdf files to post or page
- Get list of posts from attachment
- When working with a post, almost all wp_postmeta are deleted
- Displaying POST content with HTML tags and all
- How to do a MySql query in WordPress?
- Add div after every 4 posts then every 2 posts for a responsive loop
- direct query to post_meta table
- What to create new post using wp_insert_post, but it repeat the post infinitely
- Can’t put a hyperlink on Featured Post’s Image
- WordPress get_post_meta issue
- Unserializeing multiple column values that are stored in one database results variable
- See output of a sql query while plugin installation in wordpress
- Display pages from specific page template
- If Elseif Query
- Querying multiple meta_keys in WordPress SQL query
- How can I add more code to this?
- How to display the date under the post title?