Use author_can() on custom post types?
-
I’m trying to conditionally display some content in a theme using custom roles and capabilities. First, I define a custom role:
add_role('free_vendor', 'Free Vendor Listing', array('read', 'edit_posts', 'delete_posts', 'display_map'));This is run directly from functions.php (do I need to add it to an action somewhere?)
Then I use the
display_mapcapability I defined to conditionally display the map:if (author_can($post, 'display_map')) echo '<li><a href="#map">Map</a></li>';The only problem is, it doesn’t work! Is there some issue in using
author_can()with custom post types? Am I not callingadd_role()properly?
The topic ‘Use author_can() on custom post types?’ is closed to new replies.