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. Built from https://develop.svn.wordpress.org/trunk@56109 git-svn-id: http://core.svn.wordpress.org/trunk@55621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bf2569ae1d
commit
ed23ac2a04
|
@ -1376,10 +1376,15 @@ function build_query_vars_from_query_block( $block, $page ) {
|
||||||
$query['orderby'] = $block->context['query']['orderBy'];
|
$query['orderby'] = $block->context['query']['orderBy'];
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
isset( $block->context['query']['author'] ) &&
|
isset( $block->context['query']['author'] )
|
||||||
(int) $block->context['query']['author'] > 0
|
|
||||||
) {
|
) {
|
||||||
$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'] ) ) {
|
if ( ! empty( $block->context['query']['search'] ) ) {
|
||||||
$query['s'] = $block->context['query']['search'];
|
$query['s'] = $block->context['query']['search'];
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-beta2-56108';
|
$wp_version = '6.3-beta2-56109';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue