很快,您确定meta\\u键的名称拼写正确吗?在你的例子中,它说的是“authorfeld”,但也许应该是“authorfield”?而且$showme[ID]
必须是$showme[\'ID\']
除非ID
是定义的变量。
无论如何,您的$args数组都不太正确。请尝试以下示例:
// Get the posts from this author, but not this coauthor.
$author_not_coauthor = array(
\'post_type\' => array( \'post\' ),
\'posts_per_page\' => 20,
\'author\' => $author_ID,
\'meta_query\' => array(
array(
\'key\' => \'authorfeld\',
\'value\' => $showme[\'ID\'],
\'compare\' => \'NOT LIKE\',
),
),
);
// Get the posts from this coauthor, but not this author.
$coauthor_not_author = array(
\'post_type\' => array( \'post\' ),
\'posts_per_page\' => 20,
\'author__not_in\' => array( $author_ID ),
\'meta_query\' => array(
array(
\'key\' => \'authorfeld\',
\'value\' => $showme[\'ID\'],
),
),
);