๐Ÿ’Ž PREMIUM: Changeset/ - Complete Album!

Changeset 56109


Ignore:
Timestamp:
06/29/2023 01:28:49 PM (3 years ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r56064 r56109 ย 
    13771377        }
    13781378        if (
    1379ย             isset( $block->context['query']['author'] ) &&
    1380ย             (int) $block->context['query']['author'] > 0
    ย 1379            isset( $block->context['query']['author'] )
    13811380        ) {
    1382ย             $query['author'] = (int) $block->context['query']['author'];
    ย 1381            if ( is_array( $block->context['query']['author'] ) ) {
    ย 1382                $query['author__in'] = array_filter( array_map( 'intval', $block->context['query']['author'] ) );
    ย 1383            } elseif ( is_string( $block->context['query']['author'] ) ) {
    ย 1384                $query['author__in'] = array_filter( array_map( 'intval', explode( ',', $block->context['query']['author'] ) ) );
    ย 1385            } elseif ( is_int( $block->context['query']['author'] ) && $block->context['query']['author'] > 0 ) {
    ย 1386                $query['author'] = $block->context['query']['author'];
    ย 1387            }
    13831388        }
    13841389        if ( ! empty( $block->context['query']['search'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.