1. Home
  2. Wordpress
  3. Check if admin
#wordpress#php

This snippet checks if the logged in user has admin permissions and executes code if true.

if( current_user_can( 'administrator' ) ){
   // do something
}
copy
Full Wordpress cheatsheet
Sitemap Git repository