How can I allow a specific user role to pin the posts?

We have given a custom hok for the user roles to pin the post.

In order to apply this feature, add the following snippet in your functions.php file.

/**
* Allow user roles to pin/unpin posts.
*
* @param array $allow_user_roles Allowed User Roles.
*
* @return array
*/
function bpsp_allow_user_roles_for_pin_unpin_posts( $allow_user_roles ) {

$add_more_user_roles = array( 'author','editor' ); 

$allow_user_roles = array_merge( $allow_user_roles, $add_more_user_roles );

return $allow_user_roles;
}
add_filter( 'bpsp_allow_user_roles', 'bpsp_allow_user_roles_for_pin_unpin_posts', 5, 1 );

Leave a Reply

Your email address will not be published. Required fields are marked *

Update on February 21, 2022