Home > AI > Backend > Wordpress >

current_user_can( )

current_user_can( string $capability, mixed $args )

Returns whether the current user has the specified capability.

Example 1: only the administrator can view the content. You can also change this code snippte to only paid user, only author can view the specific content.

if(current_user_can('administrator')) {
    the_content();
}

Leave a Reply