You need to make a custom query to display these pending posts. Here is an example using get_posts()
:
$args = array(
'post_type' => 'post_type_name',
'post_status' => 'pending',
// -1 shows all
'posts_per_page' => -1,
);
$pending_posts = get_posts( $args );
foreach( $pending_posts as $pending_post ) {
// post object properties
$id = $pending_post->ID;
$title = $pending_post->post_title;
$content = $pending_post->post_content;
// output
echo $id;
echo $title;
echo $content;
}
If you need to filter an existing query instead of making a new one (for example, on an archive page), you should use pre_get_posts()
.
Related Posts:
- How to auto-translate custom user roles?
- upload_files cap to not loggen in users – add_cap to not logged in users
- Why current_user_can(‘edit_comment’) always true?
- Why does admin_body_class not work?
- Removing menus from users other than the administrator
- How to filter reading/visibility posts based on role?
- Testing requested query in pre_get_posts
- Filter and validate user role in registration
- Filter dashboard custom post listing by user
- Block Gutenberg Editor manually by User Roles with a Filter with code
- what is __return_false in filters
- Passing Additional Parameters to add_filter Callable
- Custom theme hooks / filters – passing arguments
- Change upload directory on custom plugin page
- What params are available with the_content filter?
- How to hook wp_list_pages?
- Don’t replace “|” with Empty String (“”) when generating slugs from title
- apply_filters(‘the_content’, $content) alternative
- How to use the_excerpt in a filter hook?
- Add wrapper to only youtube videos via embed_oembed_html filter function
- if role is logged in then do something
- Changing document title only on a custom page template
- Shortcodes not resolved in AJAX call response
- Possible to filter the posts or categories that XML-RPC users see in their mobile application?
- wp_link_pages output appears twice
- user_has_cap filter allows edit but will not allow save
- Add filter to wp_dropdown_pages() or wp_dropdown_categories() – no select container?
- Hook different functions to the same filter conditionally OR Pass additional arguments to existing filter?
- How do I pass the value from a foreach loop to an add_filter function? [closed]
- Search results sorted by post types
- Pass parameter to the upload_dir filter
- Filter or Hook to catch pre-rendering of post content
- check to see if hook is available
- Use add_filter on concatenated string variable
- Filter users by custom colum not meta key
- How to stop wrapping comments in P tag
- How to modify core when there is no hook?
- Remove CSS & JS files from WordPress Main Page For Increase Pagespeed?
- String regex match replace for role ‘contributor’ only
- Can plugins that filter post contents work on posts from Word 2007?
- html tags in gettext hook get escaped
- Set default terms for new posts / CPTs
- Get .subsubsub count of post per status queried using pre_get_posts
- Better extend a class or use add filter/action hooks?
- Adaptive product filters for WooCommerce
- Adding a Clone link to product attributes – post_row_actions() filter, or how to override a Class question
- wp_upload_bits Upload Specific Sizes Only
- Plugin options, presets and filters : can you help me improve my workflow?
- Woocommerce “added to cart” message on main(home) page
- Why does adding a filter to ‘the_title’ break the server?
- Wrapping my head around add_filter
- Add filter for specific post type only
- Avoid user registrations with specific email provider
- Help with filter for wp_notify_moderator()
- Should I remove_filter in order to replace a filter?
- Change custom post type GUID in RSS
- How can I specify the post status of an untrashed post?
- filter hook to load a different post/page on current post/page
- How would I be able to use a font awesome icon as a user’s avatar?
- Add something after a filter
- Rewrite rule and display of post
- add_filter the_content doesn’t work
- Redirect to woocommerce checkout after adding to cart – item already in cart
- Passing variable from child theme function to parent theme filter
- `authenticate` filter never gets called
- Add filter unless it is being called under specific function
- How to disable a wp filter in a certain admin panel page
- Is there a filter to programmatically change the HTML tab switching output of the page editor?
- post_orderby filter breaks function
- Disable Remember Me in Login Form
- How do I add a line break to a string that is output by PHP?
- Counting a WP_Post Object value in an arary, using a filter?
- style_loader_tag not changing stylesheet to preload
- List all categories that have results in a query
- Distinguish between page and post in function
- Display posts from today and future in Elementor ‘posts widget’
- Right filter for rewriting page statuscode
- Changing title using filter not working with argument
- Archive Widget – Count only parent posts
- How to filter page title for certain page?
- Displaying posts on a page that have been assigned a value in a database
- Replace Text with hyperlinks
- adding an action inside if condition not working
- Adding filter to an specific page/site direction
- Cutting off excerpt with first sentence
- Change URLs in default WordPress slider to relative from absolute
- How to filter wp_get_recent_posts() to only posts that have thumbnails?
- Change add_filter based on Ajax
- How to check which submission button was clicked?
- check, if any “add_action” function contains string XXXXXXXXX
- How to add more than one custom metadata as filter on the post list page?
- Add Default WordPress Formatting To Data From External SQL Tables?
- Joining tables not working in the post editor page
- Auto append text after the title?
- filter a list by gender
- Filter and manipulate the get_current_user() function
- add_filter(‘the_content’, ‘method’) does not trigger my custom method
- Query Multiple Filters, one with Meta
- How to remove a filter that is an object method?
- Search and Filter Using Custom Post Type, Custom Taxonomy, and Advanced Custom Fields