How to Create an admin User with functions.php

Adding an Admin User in WordPress Once connected to your WordPress site, you need to locate your WordPress theme’s functions.php file. It would be at a location like this:/yoursite.com/wp-content/themes/your-current-theme/functions.php Now you need to add this code at the bottom of the file.

Shortcode for content view access restriction

Shortcode to display the content only to the specific roles you can use this shortcode to show content only to specific user roles. How to use user role shortcode You can see example below. [user_role role=”aministrator”]Admin[/user_role] [user_role role=”subscriber”]Subscriber[/user_role]