您的问题可能是订阅者无法删除帖子。请尝试以下内容以了解情况。
if ( !current_user_can( \'delete_post\', $post->ID ) )
{
echo \'I do not have the privilege to delete posts\';
}
else{
get_delete_post_link( $post->ID );
}
以上内容可能会让任何用户删除任何其他用户的帖子,从而给您带来麻烦,因此以下内容旨在仅允许具有订阅者级别的帖子所有者删除其帖子或具有正确权限的人。
if ( get_the_author_meta(\'ID\') == get_current_user_id() && current_user_can(\'subscriber\') )
{
// owner of post and subscriber
get_delete_post_link( $post->ID );
}
if ( get_the_author_meta(\'ID\') != get_current_user_id() && current_user_can(\'subscriber\') )
{
// not the owner of post and subscriber
echo \'Not your post\';
}
else
{
// should be ok as not a subscriber and has delete privilages
get_delete_post_link( $post->ID );
}