The WordPress REST API includes a ‘status’ parameter that can be used to retrieve posts based on their status. By default, the API only returns posts with a status of ‘publish’. If you want to query ‘pending’ posts, you’ll need to add ‘status=pending’ to your API call. However, please note that you will need appropriate permissions (typically an authenticated user with author or higher capabilities) to view non-published posts.
So your API call would look something like this:
/wp-json/wp/v2/posts?status=pending&_fields=yoast_head_json,date,modified,link,title,author,comment_status,status&per_page=100&orderby=modified&order=desc&page=2
Remember, the WordPress REST API respects all privacy and capability controls, so make sure your API call is authenticated with a user that has the correct permissions to view pending posts. Otherwise, you’ll get a response that you’re not authorized to view the resource.
Related Posts:
- Changing WooCommerce Display Price Based on User Role & Category [closed]
- Not able to change wp_title using add_filter
- How to hook a filter to catch get_post_meta when alternate a custom field output?
- Changing JPEG compression depending on image size
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- What do add_filters() and apply_filter() do?
- add_filter to youtube embeds?
- SSL certificate for the host could not be verified
- Store source permalink on XMLRPC calls
- What to use instead of the content_save_pre filter?
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- How can I customize the wp_list_categories
- How can I reliably and globally disable wptexturize?
- Customise Jetpack Publicize text
- Can’t change a label in woocommerce with the normal filter
- WordPress RSS feed – filter RSS content by custom field value
- What is the filter hook for custom fields content?
- Filter keywords from search query
- Add class to woocommerce checkout body based on filter [closed]
- Add classname to the_category() function?
- Filter the URL of next_posts_link & previous_posts_link
- Changing Gutenberg / WP block editor width only on pages, not posts or other taxonomies
- How to replace any occurence of Gravatars with a local placeholder image?
- Explanation for remove_filter used in the below code [closed]
- How to change the blog title with add_filter? details below
- How To Get User Data in Callback Function for pre_user_nicename?
- What’s the best way to split admin-only functionality in the theme’s functions.php file?
- Gutenberg disable the “block” tab in right sidebar
- Editing
- the_content filter – checking the post
- add_filter to apply_filters that exists within class
- Which built-in WordPress files are safe to edit?
- How do I target a single page to modify the comment form of only that page?
- Adding a title prefix with the the_title filter
- How to removes all instances of thumbnails displayed in my theme?
- Contact Form 7 filter similar to preprocess_comment [closed]
- Walker_Nav_Menu doesn’t work in wp_page_menu_args filter
- How to modify an existing meta description?
- Adding TinyMCE buttons without removing plugin buttons?
- Can the wordpress color palettes by changed through Javascript?
- Filter on the_content doesn’t update the content being searched via register_rest_route
- Where to add_filter in theme functions.php?
- upload_files cap to not loggen in users – add_cap to not logged in users
- tag removed not using a filter
- How to customize the “Insert/edit link” popup box?
- How to filter backend post list showing only posts having a shortcode
- Add Lightbox To WordPress Native Gallery
- How do I override the_excerpt so that it will display full content?
- Why does WordPress strip custom HTML that are form elements and theme SVG icons?
- Get current user data
- get_post() containing gallery is outputting an unmatched closing div at the end of the content
- How can you wrap add_filter with a if is_home() statement?
- How to add attributes to WordPress Admin Sub Menu List Items
- How do I hook my function to run only after submitting login form
- How to combine multiple body classes
- How to replace username with email address in users table
- How to write a filter to remove a form field (WordPress) [closed]
- Why doesn’t this function work when I know that the IP Address is “true”?
- why require – does not load filter
- term_link filter rewrite link only applying half of condition?
- How to change dynamically page title according to variable data?
- Map plugin with proximity search compatible with Buddypress
- Create a pre-filtered version of the Media Library
- What is the action hook to use if you want to capture the new password during password change?
- Get_template_part inside filter?
- How to filter Sidebar Content
- Removing URL and adding container around image in the featured image metabox
- How would I use a filter to remove header banner on certain post types
- What are the steps + prerequisites for using an add_filter?
- Excluding posts by meta, and also keeping posts without the meta
- Replace Data In Post & Update Meta Field Post Is Saved
- How to add custom media library mime icons?
- Customising the default wordpress search functionality
- get_post() with filters applied
- I want to add string array to this function to filter displayed option in drpodown [closed]
- Ajax filter – show all results that contain at least one filter
- WP_Query filter by custom meta
- How to add a blog filter bar without paying money. (example inside)
- How to wrap pattern-matches from the_content in [wiki]-shortcode tags
- Override admin selected page layout
- WordPress: Issue with filtering users using date range
- Does anybody know what the $current_screen ->id for customizer.php is?
- How to filter reading/visibility posts based on role?
- Filter and validate user role in registration
- wordpress filtering out caps in wp_title? (UpperCase is changed to Uppercase)
- Unable to get WordPress’s apply_filters(‘site_url’) to return a https scheme
- String Replace Caching & Chance of Collisions
- is_page_template() doesn’t work with excerpt_length filter
- Turn wp_tag_cloud into a front-end filter
- What is the scope and persistence of add_filter() and remove_filter()?
- Add HTML to Page Content
- Filter dashboard custom post listing by user
- GET form action. Redirect to self
- if i put the code in my theme’s function.php file can it work?
- Admin New Order: Autofocus on Search a product
- Filter widget_pages_args not working in Pages Widget
- This code works, but breaks the media uploader. How do I integrate it in a way that won’t?
- Are blocks that are converted to patterns no longer filterable through the_content?