you need to populate the
current_user_can('')
function before using it
using
get_currentuserinfo();
so try this code:
add_action( 'admin_menu', 'fb_redirect_2' );
function fb_redirect_2(){
get_currentuserinfo();
if ( current_user_can('edit_posts')){
//redirect here
}
}
Related Posts:
- PHP header(Location: …): Force URL change in address bar
- php refresh current page?
- Host the wp-admin on another domain?
- WordPress localhost site redirect to live site
- My wordpress multisite homepage redirects to signup page
- Login redirect to previous page
- WordPress install enters an infinite loop
- WordPress HTTPS redirect loop
- Using `auth_redirect` : keeps asking me to login even when I’m logged in
- How can I move/redirect single blog posts from one blog to another?
- 302 redirect instead of 301 after switch to HTTPS
- How do I skip wordpress’s 404 handling?
- Redirecting to home-page when saving any edited code
- Can WordPress redirect to a “similar page” in case of 404 error
- Hacked website redirect, only on desktop, help with restoring it [closed]
- Can I check for maintenance mode before redirecting to subdomain?
- Moving variables from one page to another
- How to create a 301 redirect that doesn’t apply to subsites
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- Custom Registration page – prevent redirect to wp-login.php?action=register
- https redirect (with .htaccess) redirect loop
- How to auto login after registration? [duplicate]
- homepage redirects to login page when user session expires
- How to redirect user to a specific page based on username?
- Redirect blog archive into certain format
- How to publish new posts/pages in root instead of subfolder, but keep old structure in place?
- forward domain name to particular page?
- Contact Form 7 Data to Whatsapp Link
- htaccess 301 Redirect not working for WordPress site
- Auto-detect the redirect url from the original url
- How can I replace my primary url globally with a parked one?
- I need to redirect an entire subdirectory in WordPress to the homepage – is this correct?
- My website on checking showing 403 error on HTTP Status [closed]
- I get redirected too many times only in wp-admin?
- Redirecting Pages That No Longer Exist — But Could in the Future
- How do I determine what is causing a redirect for a given page?
- Trouble running local WordPress in Google App Engine
- Empty folder being created by WordPress, breaks site
- About to migrate site to new domain
- Redirect all users to dashboard unless custom post type
- Redirecting connection from IP to localhost
- WordPress directing to Posts page (edit.php) instead of saving post
- HTML Redirect to WP pages
- Changing theme = change home page for mobile visitors?
- WP_List_table with form of method=GET redirects to wrong url after submit
- WordPress localhost site always redirect to live site [closed]
- My Cloned WP site keeps redirecting to the old one
- Can’t do 301 Redirect, Why?
- Redirect old query string URLs to new add_rewrite_rule URL
- WordPress Permalink Problem 404
- How can I set up a splash page that is redirected to only one time for the visitor? [closed]
- Is there way to redirect all blog post pages to Home page?
- Temporary Infinite Redirect Loop
- Select post from dropdown and add query args not working
- Trying to map a PURL like url to a page
- A question about .htaccess
- Add new post redirection [closed]
- Blog keeps redirecting to the contact page
- Can’t login to WordPress admin panel after changing domain to use WordPress pages as a fallback from React
- WordPress Pagination – 301 Redirect Issue
- Why do my new WordPress pages redirect to home / staging site?
- WordPress multi domain: page redirect to main domain whenever WordPress do the URL guessing issue
- Puzzled at HTTP/2 301 response header
- Applying ‘middleware’ to a url before redirecting? Does WP have built in mechanism for this?
- How to regenerate RSS feed URL like FeedBurner?
- How to avoid redirect 302 in wordpress to the author pages?
- ErrorDocument 410 gives me back a 302 header
- ERR_TOO_MANY_REDIRECTS when switching from good database to old database
- Redirect to /404/
- WordPress Staging site is redirecting to live and lost the child theme
- Mailjet Email Subscription + Redirect w/ Custom Template Fails
- domain redirects to subdomain
- htaccess Redirect 301 doesn’t work. How to debug?
- Having a different landing page for returning users
- How to create multiple Rewrite-Rule for various site in single htaccess?
- how can i find malware code and remove from wordpress site to stop it redirecting to hackers click view pages
- Redirect after plugin activation
- Redirect affecting development folder
- change home_url and site_url but don’t redirect to home_url and site_url on load
- How do I skip wordpress’s 404 handling?
- All devices on my network redirect me to an old domain
- WordPress multisite and redirect to subpage
- My WordPress site redirects to port 8082
- wp-login.php redirect problem
- How to redirect 404s that generated for css&JS files?
- Custom, conditional redirect on logout
- International characters in slugs to redirect to
- How to Block WordPress from subdomain?
- login page not working [closed]
- Debugging a redirect loop affecting only certain pages
- WordPress redirect to splash page once a day for the first week
- after logout, get_current_user_id still holds value
- noheader on the user/frontend side
- Solution for WordPress URL structure changes and 301 redirects?
- WordPress redirect from one directory to another but exclude wp-admin and wp-login.php
- How can I redirect foreigners by IP to other URL in WordPress?
- How to change Ugly link?
- WordPress site redirecting to developers URL
- How to use the HTTP API (wp_remote_get) instead of cURL?
- After migration index page still redirects to old url