is_admin

Home » Functions » is_admin

The is_admin function in WordPress is a conditional tag that checks whether the current page is the admin page or not. It returns true if the current page is the admin page, and false if it’s not.

This function is commonly used in WordPress themes and plugins to determine whether to show certain content or execute certain functions based on whether the user is currently in the WordPress admin area or not.

For example, if you have a plugin that adds a new settings page to the WordPress admin area, you might want to use the is_admin function to check whether the current page is your plugin’s settings page, so that you can display the appropriate content or execute the appropriate functions.

Here’s an example usage code:

if ( is_admin() ) {
  // Do something only if we're in the WordPress admin area
}

Learn More on WordPress.org

Register an account to save your snippets or go Pro to get more features.