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
- Issues applying JSON body filters in EU F&T Portal SEARCH API with WordPress integration
- Remove posts after a given amount of time
- Preferred Method of debugging a wordpress SQL calls?
- Working with query_posts ( arrays and query strings)
- Automatically add custom CSS to new posts using a category template
- Why is variable not working on custom sql query using wpdb?
- How to get a list of all possible values of a specific user meta key?
- How Display Posts on category
- Hide wordpress field if data is empty in post!
- Can’t search posts using WP_QUERY inside AJAX Function
- How can I use wp_query to show all product data using just the products ID?
- Query all posts of a custom taxonomy term
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Retrieving Author ID in wp-admin area
- Any possible way to make $wpdb->get_results() return anything else than array?
- Getting a specific post values to another div or modal
- Custom filter in admin edit custom post type responding with invalid post type?
- Trying to add attribute to my posts’ featured image
- Transferring working local PHP site to wordpress – with database (MySQL)
- how to delete 30 day old data using PHP [closed]
- Accessing the database from a plugin outside of action hooks
- Echo a hierarchical list of post data from custom fields
- Display fields as values in array from external SQL DB
- Can’t get wp_insert_post to work
- Why not yield/iterable in posts interface?
- Create WP_Query to search for posts by their categories or their parent/child categories
- WP Query with custom Shortcode
- Best practice for migration friendly images in posts/pages?
- Storing Array from returned database query and using the array in a new query
- How to show part of the_content?
- Using loop pagination on single.php
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Logged in user ID as post ID
- mysql query from wordpress page using custom table
- Most liked page not displaying posts
- Sort query_posts for Parent Pages to menue order or the count?
- WordPress 3.2 query_posts and pagination, permalinks issue
- Importing Geo data into wordpress database
- Detect session/cookie variable in wordpress to prevent access to documents
- only show container with next/prev links if they exist?
- Unreadable pagination
- 200 Rewrite blog post links
- What query string parameter is available for index.php, that works for both pages and blog articles?
- ACF: how do I get the fields and its values of a specific group?
- How to set a min number of words for a blog post
- Loop through categories and display posts title under each dropdown
- Get post id in a function when edit/add a post
- how do I get a specific post from a post with a subcategory in WP
- Automatically create child pages and grandchild pages when saving a (parent) page
- Querying wpdb using PHP
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Set WP_query ‘order’ option by another tables value
- Second transition_post_status hook fired instead of the first
- WordPress default Search function inconsistent in WooCommerce Product Titles
- How to store post ID’s in cookie or session to display the same posts later
- Which hook/action will help me solve my problem?
- How can I add extra word in permalink when someone click download button?
- Increase offset while looping
- Long running queries
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- Post + form + action + results on the same page
- Open post-content in archive page in a Modal box with bootstrap
- How to pre populate a form field with a link of a current user’s author profile?
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Trying to get a PHP variable defined in a custom post into a javascript file. Null value. Using wp_localize_script
- remove post that has no content
- Archive post by meta value + 24hours
- Query if audio attachment AND/OR custom field
- Loading index.php contents which located outside blog folder for post single page
- get post content of particular post by url