post_status
is part of the $post
object which you can use to determine if it is published, a draft, pending, etc.
if( $post->post_status == 'pending' )
// do stuff
Related Posts:
- How to force a 404 on WordPress
- Redirect Restricted Page to 404
- How to prevent automatic redirection of 404 errors and “incorrect” URLs?
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- How do I programmatically generate a 404?
- How do I skip wordpress’s 404 handling?
- 404 redirection and Google’s index [closed]
- Redirect feed to 404 page
- Why specific file directory fails to redirect but its parent folder succeeds?
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- Deny access to a path (give 403 or 404 response)
- Redirect a page id url but not the page slug
- Defining a custom 404 for non-WordPress parts of site
- WordPress Auto-Redirecting on 404
- Built-In Postname Redirection vs Hard Redirects in relation to SEO and performance
- How to redirect a wrong search on my wordpress website to the error 404 page?
- WP page 404 error only on mobile
- Force 404 redirect to home?
- How can I redirect users on the new 404 page without plugin?
- How to redirect an old page url to the homepage
- Dynamic 404 page content while still keeping 404 status code?
- Redirect to home if page doesn’t exists [duplicate]
- Redirect to parent page if child does not exist
- How to redirect non existent pages/posts in wordpress using htaccess
- How to Redirect WordPress domain.com/?anyword to 404 Page?
- How do I redirect the browser to 404 page, if no posts are found in home page
- How do i make WordPress return 404 instead of redirecting on misspelled page?
- How to redirect if 404 error in wordpress then redirect 404.php url
- Redirect to /404/
- Page editing in backend redirecting to 404 page not found with url /post.php
- How do I skip wordpress’s 404 handling?
- Subpages return 404 server error
- WordPress subfolders htaccess bypassing the root htaccess RewriteRule
- Why my htacess rewrite return 404?
- How to Redirect Url to homepage?
- Stopping media file redirects
- Forcing header cache control in 404 pages
- redirect to 404 page
- Redirect certain 404 pages to parent page
- Non-WordPress page in subdirectory under WordPress page
- Clarification on auth_redirect()
- Exclude a path from WordPress using .htaccess redirects (Apache)
- Restrict Access to wp-login.php
- Stop unwanted WP redirection to new url
- Problem to redirect custom page using htaccess
- Website redirecting to old domain name
- How to do 301 redirect to Sub page using htaccess file?
- How to redirect user to specific page based on the input password
- Strange redirection issues on wordpress from ssl with padlock to ssl without padlock
- How do I redirect /search/ to ?s=
- 301 Redirect Loop
- Have functions work outside the loop with 404 override
- Redirect from home page to post list page?
- set up 301 redirect within wp-content/uploads/ directory of a WP site to a new image URL
- How to redirect user after login to a specific page?
- .htaccess Redirect
- Custom Post Type Draft Preview Goes to 404
- Redirect when accessing /login when logged in
- Local Environment Stripping Port Number…help tracking down the redirect?
- User is logged in after Stripe payment, then redirected, but is then logged out again
- How To Fix A Redirect Chain
- 301 Redirect Old URL to New WordPress Page
- Login Redirect – Multiple Scenarios
- URL masking of subdomain to main domain using .htaccess
- Redirect outside WP after login
- Redirecting from wp-content?
- Redirect user on first visit based on geographical location
- Create a permalink to a pdf?
- My site doesn’t redirect from HTTP to HTTPS
- Bedrock WordPress
- Only execute function if SSL is set up properly
- Redirect User to login page
- Redirect after get_delete_post_link
- Disable and Hide WP-JSON
- Redirect when not logged and parametr in link
- Browsers Forcing Multisite to https
- Hide a Post everywhere except on redirect
- Keep the old referrer after failed login
- How to 301 redirect WP posts id “/c/94940894” to permalink with post name?
- URL redirect regular expressions redirecting all after first viriable
- 301 Redirect Link to Media
- WordPress Redirect post to outside website based on useragent
- How to create mass 301 redirects with PHP in Nginx server without using a WP plugin
- HOW do you Redirect buddypress login to EDIT tab not PROFILE tab on profile page? [closed]
- WordPress redirects to backend when i’am not logged in
- Redirect to custom admin menu after plugin activation
- 301 Redirects when change URL in WordPress database
- How can I redirect to another page with screen already at the bottom of the page?
- How is this URL being redirected?
- What’s the best way to redirect to a new wordpress website?
- How to move a https website back to dev and access the admin?
- Why is WordPress redirecting to homepage after GET form submit?
- Redirect after user changes password
- Custom Form Redirects to Post after Submit
- URL is redirecting (301) when query string is passed through URL
- Hide page for user logged and redirect for profile? [duplicate]
- Redirect ignore last URL segment
- Creating custom link that redirects to a another link
- How to find out what is causing redirect of static content?
- Post pages are redirecting to the 404 page in wordpress