mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Editor: Allow Query Block to show posts from multiple selected authors.
This changeset adds handler for multiple cases where author data can be passed to the Query Block: - array: array of author ids - string: comma separated author ids - integer: single author id Props adi3890, costdev, mayur8991, oglekler. Fixes #58426. git-svn-id: https://develop.svn.wordpress.org/trunk@56109 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1376,10 +1376,15 @@ function build_query_vars_from_query_block( $block, $page ) {
|
||||
$query['orderby'] = $block->context['query']['orderBy'];
|
||||
}
|
||||
if (
|
||||
isset( $block->context['query']['author'] ) &&
|
||||
(int) $block->context['query']['author'] > 0
|
||||
isset( $block->context['query']['author'] )
|
||||
) {
|
||||
$query['author'] = (int) $block->context['query']['author'];
|
||||
if ( is_array( $block->context['query']['author'] ) ) {
|
||||
$query['author__in'] = array_filter( array_map( 'intval', $block->context['query']['author'] ) );
|
||||
} elseif ( is_string( $block->context['query']['author'] ) ) {
|
||||
$query['author__in'] = array_filter( array_map( 'intval', explode( ',', $block->context['query']['author'] ) ) );
|
||||
} elseif ( is_int( $block->context['query']['author'] ) && $block->context['query']['author'] > 0 ) {
|
||||
$query['author'] = $block->context['query']['author'];
|
||||
}
|
||||
}
|
||||
if ( ! empty( $block->context['query']['search'] ) ) {
|
||||
$query['s'] = $block->context['query']['search'];
|
||||
|
||||
Reference in New Issue
Block a user