Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#62701 new enhancement

Post controller: support for grouping results by parent-child relationship

Reported by: oandregal's profile oandregal Owned by:
Milestone: 6.8 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

The current wp-admin displays hierarchical posts grouped/sorted by hierarchy. To implement the same behaviour in the site editor, we need to the REST API to support the same functionality.

See details in the related issues/PRs:

Change History (1)

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


3 weeks ago
#1

  • Keywords has-unit-tests added

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

See related Gutenberg issues/PRs:

## What

This PR expands the post controller to allow returning the data by parent-child relationship (sort by hierarchy).

## Why

We want to display data in a hierarchical way in the site editor, similarly to what we do in wp-admin:

wp-admin site editor
https://github.com/user-attachments/assets/6facad5b-acad-4671-a166-9ececeba5ccc https://github.com/user-attachments/assets/81f94e96-12c1-49f5-8c05-664f4ae27ddd

## How to test

Added a new test suite to test the logic. Without the related Gutenberg PR this is difficult to test.

Note: See TracTickets for help on using tickets.