function mmk_pending_review_redirect(){
$user = wp_get_current_user();
if(get_post_status ( get_the_id() ) != 'publish')
if (is_user_logged_in() && !in_array( 'administrator', (array) $user->roles ) && !is_author() ) {
wp_redirect( "https://example.com/under-approval");
exit;
}else{
wp_redirect( "https://example.com/under-approval") );
exit;
}
}
}
add_action('template_redirect', 'mmk_pending_review_redirect');
explanation: redirect non-admin users to custom URL if they are not author of the current post where status is not published. (change page id to your custom page)
Related Posts:
- Redirect user to original url after login?
- Redirect to dashboard after login
- Make a video post redirect to next post after completion
- Site redirects to wrong url when saving settings
- WordPress Redirect based on the prescence of a cookie
- Links to an exisiting Page are now redirecting to a draft page?
- Random and Erroneous WordPress Redirect
- Redirect Old domain & posts to new domain homepage
- Redirecting users to referrer page after logging in using custom login form
- Remove lost password form and URL
- What is the wordpress way of displaying local external content?
- How To Only Allow Users To View Their Own Buddypress Profiles? [closed]
- htaccess redirect dynamic posts
- RedirectMatch and Redirect interfering with each other
- Menu links only using http after enabling https, unable to redirect http links
- Redirect all pages to homepage but still allow dashboard
- some url does not redirect from http to https
- Why can’t I access files / directories outside of wordpress
- Change ‘Back To Website’ link in wp-login.php
- How do I map a subdomain in wordpress to the primary domain in a multisite setup?
- Redirect the non-www version of the site to the www
- htaccess rules not applied?
- Intercept the “lost password” action by first redirecting to an existing instructions page
- How to redirect after login getting a variable from url (for example with the language)
- How to set 301 redirection after moving WordPress blog?
- How to include error message on login
- How to use a custom domain?
- Changing siteurl and homeurl – internal links redirect to home page?
- WooCommerce unexpected behavior [closed]
- Force WordPress to load from site’s hostname
- redirect Login problems
- 301 redirection editing .htaccess doesn’t work
- Redirect custom post type from one domain to another domain
- How can I force the user to log in, even if they’re already authenticated?
- 301 redirect instead of 404 when URL is a prefix of a post or page name?
- 301-redirect directives for blogger to wordpress migration
- Redirect users after register (first login) and force submit post
- Some admin pages redirecting to front page on save
- Stop Redirecting to and from www
- How to pass a message using template_redirect
- .htaccess 301 redirect conflict with plugin “WordPress Https”
- Disable WordPress URL auto complete
- How do I put up a splash page and have all WordPress links redirect to this page?
- How can I disable author pages without 301 redirects?
- Redirect specific URL before other redirects take place in .htaccess?
- Redirect Main Home Page url to category URL without plugin
- W3 Cache redirects to front page when I press purge all caches
- Stop forcing certain paths to end with a forward slash
- Force 404 redirect to home?
- Is it possible to wp_redirect() to a new tab?
- How to delete a post and keep its slug to refer to another post
- Dynamic 404 page content while still keeping 404 status code?
- Redirect loop with similar URLs
- Redirect user to specific link after login
- After retrive password, redirect to index page
- Change Category Slug Redirection
- custom login form redirect problem
- WordPress redirect to new domain name
- Blog post is redirecting to home page
- Trying to re-direct users to specific page based on an ACF variable
- wp_redirect is only working in Chrome Network, page is not redirecting
- Bulk redirect all post
- Disable redirect to homepage after successful Login, Stay on Current Page
- WordPress no permission redirection to a popup
- 301 all old pages to new location
- Use a 301 to Redirect any 404 from at the blog post level to the blog archive
- How do I share a site only to one User at the time? Please help π₯Ίπ
- Re-Direct ALL Users to the Home Page IF not logged in
- Need to redirect home page only on Woocommerce site if user logged in
- Redirect to dashboard user once you click on Publish page
- Author Archive Page redirecting issue
- Understanding Redirects
- Changing auth_redirect() page
- Why https://www. SUBdomain is redirected by WP to https://MAINdomain
- Page editing in backend redirecting to 404 page not found with url /post.php
- wordpress redirect error in xampp
- Redirect based on referer using Advanced Custom Fields
- Swapping current old site to new WordPress site – need to check I’m doing it right
- Redirect User to Specific Page
- How to redirect a referal url to a signup page?
- Allow GET request on certain page
- How to modify the WordPress comes with redirect
- Conditional redirect on login using referring URL
- PHP Mistake – Whats wrong here?
- On login redirect to different homepage if user is using a mobile
- Multisite hide subdirectory
- WordPress update 4.4.1 redirect loop
- Redirecting Issue
- How to redirect correctly a root domain to a subdomain in a subfolder?
- 301 redirect for wordpress permarlink
- login_redirect for Mobile Web
- Need rewrite for URL with specific string
- Redirect to 404.php from single.php
- How to make my homepage automatically redirect to an external website?
- How does the flow of htaccess files in sub-directories work
- Redirect to a subdirectory frontpage using without using a WP plugin- what files to edit, and how?
- How to Show different page URL instead of default home page URL
- How to Redirect Url to homepage?
- 404 Not Found with All Cloaking plugins
- After migration index page still redirects to old url