Skip to content

Use search_columns=post_title for parent page selector REST API searches#78683

Open
sarthaknagoshe2002 wants to merge 2 commits into
WordPress:trunkfrom
sarthaknagoshe2002:fix/issue-74631
Open

Use search_columns=post_title for parent page selector REST API searches#78683
sarthaknagoshe2002 wants to merge 2 commits into
WordPress:trunkfrom
sarthaknagoshe2002:fix/issue-74631

Conversation

@sarthaknagoshe2002
Copy link
Copy Markdown
Contributor

What?

Closes #74631

This PR ensures that the parent page selector restricts its server-side REST API queries to search specifically against post_title instead of executing a global keyword search across titles, excerpts, and content.

Why?

When searching for a parent page in either the Page Attributes sidebar or the DataViews interface, the client-side filters records strictly by title. However, the REST API returns any page containing the search term in its body or excerpt.

If too many pages match via content, they consume the per_page: 100 payload budget and push actual title matches out of the response. Furthermore, non-title matches that are returned get silently hidden by the client-side UI, resulting in zero visible options or unexpected missing results for the user.

How?

Added search_columns: [ 'post_title' ] to the query object configuration when a search filter (fieldValue) is active across both implementations of the selector:

  1. packages/editor/src/components/page-attributes/parent.js (Classic Block Editor sidebar)
  2. packages/fields/src/fields/parent/parent-edit.tsx (DataViews / Site Editor interface)

Testing Instructions

  1. Create few pages containing a specific distinct word (e.g., "Security") only in their body content (leave titles as "Test Page A", "Test Page B", etc.).
  2. Create exactly one page with that same word in its title (e.g., "Security Documentation").
  3. Navigate to the Parent page selector dropdown in the sidebar or DataViews and search for "Security".
  4. The API should return page titled "Security Settings" and should not result in an empty list or missing matches.

@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. [Package] Editor /packages/editor labels May 26, 2026
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @hamsterkacke.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: hamsterkacke.

Co-authored-by: sarthaknagoshe2002 <sarthaknagoshe2002@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added the [Package] Fields /packages/fields label May 26, 2026
Copy link
Copy Markdown
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @sarthaknagoshe2002!

This works as expected ✅

P.S. GitHub actions are experiencing some issues, and we might have to wait a bit until that's resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Editor /packages/editor [Package] Fields /packages/fields [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parent page selector should use search_columns=post_title for REST API searches

2 participants