Make WordPress Core

Opened 19 months ago

Closed 18 months ago

Last modified 18 months ago

#58426 closed defect (bug) (fixed)

Bug: Query Loop: Authors filter generates posts of only first selected author.

Reported by: adi3890's profile adi3890 Owned by: audrasjb's profile audrasjb
Milestone: 6.3 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch has-testing-info commit
Focuses: Cc:

Description

While using guntenberg block Query Loop I found an issue that actual reslt in frontend doesnot match multiple authors selected in editor. Result is populated only on the basis of first author selected in Authors filter.

Steps to replicate.

  • Drop a query loop in a any post
  • Add Multiple Authors in Authors Filter, update the page.
  • Visit frontend

Expected

  • Posts should be generated as per selected Authors

Actual Result

  • Posts generated only on the basis of first selected author in the list of authors filter

Change History (9)

This ticket was mentioned in PR #4521 on WordPress/wordpress-develop by @adi3890.


19 months ago
#1

This PR handles multiple cases where author data can be passed in any data format

  • array - array of author ids
  • string - comma separated author ids
  • integer - single author id.

Trac ticket: https://core.trac.wordpress.org/ticket/58426#ticket

#2 @costdev
19 months ago

  • Component changed from General to Editor
  • Keywords has-testing-info added
  • Milestone changed from Awaiting Review to 6.3

Test Report

Patch tested: https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/4521.diff

Steps to Reproduce or Test

  1. Create two additional author users: Author 1 and Author 2.
  2. Create two posts. Assign Author 1 to the first, and Author 2 to the second.
  3. Create a new post as the default admin user.
  4. Add a Query Loop block.
  5. Click the + in the Filters section and select Authors.
  6. Add Author 1 and Author 2.
  7. Save the post.
  8. 🐞 View the post on the frontend.

Expected Results

When reproducing a bug:

  • ❌ Only the post assigned to Author 1 is shown.

When testing a patch to validate it works as expected:

  • ✅ Posts by both Author 1 and Author 2 should be shown.

Environment

  • WordPress: 6.3-alpha-55505
  • PHP: 7.4.33
  • Server: Apache/2.4.56 (Ubuntu)
  • Database: mysqli (Server: 5.7.41-0ubuntu0.18.04.1 / Client: mysqlnd 7.4.33)
  • Browser: Chrome 113.0.0.0 (Windows 10/11)
  • Theme: Twenty Twenty-Three 1.1
  • MU-Plugins: None activated.
  • Plugins: None activated.

Actual Results

When reproducing a bug/defect:

  • ❌ Only the post assigned to Author 1 was shown. Issue reproduced.

When testing the bugfix patch:

  • ✅ Posts by both Author 1 and Author 2 were shown. Issue resolved with the patch.

  • Moving to the Editor component and milestoning for 6.3.

This ticket was mentioned in Slack in #core by adi3890. View the logs.


19 months ago

#4 @mayur8991
19 months ago

Hi
Patch works fine

Test report for - https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/4521.diff

Environment:
WordPress - V6.2.2
Theme - Twenty Twenty-Three Version 1.1
Os: Windows
Browser: Chrome
PHP - 8

Expected Result: Posts should display based on author chosen from backend Query loop widget settings

Before Patch:
Backend query loop widget setting - https://prnt.sc/GvzF5zUqOz-e
Frontend posts - https://prnt.sc/1pSFIurnUf1Q

After Patch:
Backend query loop widget setting - https://prnt.sc/aNwSYEcqlV3c
Frontend posts - https://prnt.sc/uZDzcEjrbx1h

Thanks!

#5 @oglekler
18 months ago

  • Keywords needs-testing added

I am adding needs-testing to highlight that this patch is ready for the review.

#6 @costdev
18 months ago

Hi @oglekler as this has a couple of test reports, would commit be more appropriate here so that it appears in the commit queue for final review?

Last edited 18 months ago by costdev (previous) (diff)

#7 @oglekler
18 months ago

  • Keywords commit added; needs-testing removed

@costdev, yes, you are right. I tested patch as well.

🙌 good job, everyone!

#8 @audrasjb
18 months ago

  • Owner set to audrasjb
  • Resolution set to fixed
  • Status changed from assigned to closed

In 56109:

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.

Note: See TracTickets for help on using tickets.