• I’m struggling to get a custom shortcode to work. I’ve mapped custom capabilities to users and wish to restrict content based on each individual users capability.

    The custom capabilities match the name of the post categories. I’m trying to make a shortcode that uses <?php current_user_can( $capability ); ?> where the capability is the category slug name. The shortcodes would include content that is displayed only if current_user_can($post_category_slug)

    Something like:

    <?php current_user_can( get_the_category() ); ?>

    But I am struggling with syntax.

    https://ww.wp.xz.cn/plugins/shortcodes-ultimate/

The topic ‘current_user_can with category lookup’ is closed to new replies.