Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 获取所有参与wordpress帖子的用户_Php_Wordpress - Fatal编程技术网

Php 获取所有参与wordpress帖子的用户

Php 获取所有参与wordpress帖子的用户,php,wordpress,Php,Wordpress,我想找回所有为wordpress帖子投稿的用户。因此,f.ex.:创建并更新帖子或其中的自定义字段的用户 我尝试了以下方法通过特定角色获取用户: /* Query arguments. */ $query_args = array( 'role' => $instance['role'], 'number' => $limit ); $users = get_users( apply_filters( 'display_authors_widget_quer

我想找回所有为wordpress帖子投稿的用户。因此,f.ex.:创建并更新帖子或其中的自定义字段的用户

我尝试了以下方法通过特定角色获取用户:

/* Query arguments. */
$query_args = array(
    'role' => $instance['role'],
    'number' => $limit
    );

$users = get_users( apply_filters( 'display_authors_widget_query', $query_args ) );
然而,我不知道如何让“贡献”到帖子的用户。是否有许多特定角色需要查询


非常感谢您的帮助

用您的参数尝试这些参数

$query_args = array(
        'role' => $instance['role'],
        'number' => $limit,
        'query_id' => 'authors_with_posts',
        'order'   => 'ASC'
    );

 $users= new WP_User_Query( $query_args );

我不认为WP在默认情况下提供了这一点。您可能需要检查所有的后期修订,并检查创建/编辑“作者”是谁。@CBroe Thx,请回答。你完全理解它。如果您能提供一个编码的答案,我将不胜感激。谢谢您的回答!这给了我一些帖子的所有作者。但我需要所有的作者、编辑、管理员等,他们创建/更新了这篇文章。