Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    Are you sure you want to use is_admin function? It checks if your in dashboard and not if current user is admin... Commented May 7, 2018 at 5:10
  • @KrzysiekDróżdż You're right! I updated my answer, and Wordpress Codex link. Commented May 7, 2018 at 5:21
  • 2
    First paragraph in linked article says clearly that you SHOULD NOT use current_user_can with roles... Commented May 7, 2018 at 5:25