Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
You need to look at this article
Hide the button from the "Subscriber" role
<?php
if ( !current_user_can( 'subscriber' ) ) { ?>
<button>Кнопка для всех (кроме подписчиков)</button>
<?php } ?>
<?php
// Видно будет только администраторам
if ( current_user_can( 'administrator' ) ) { ?>
<button>Кнопка для администратора</button>
<?php } ?>
current_user_can('administrator') // false
current_user_can('editor') // true
current_user_can('contributor') // false
current_user_can('subscriber') // false
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question