Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#35010 closed enhancement (fixed)

Quick Edit: do not apply level to non-hierarchical post types

Reported by: offereins's profile Offereins Owned by: chriscct7's profile chriscct7
Milestone: 4.6 Priority: normal
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: has-patch
Focuses: administration Cc:

Description

Context
In my code I have set my non-hierarchical post type unit to have a Page as a parent page (using the wp_insert_post_parent filter). That way I have ensured that all units will have the same parent in the site's hierarchy.

Issue
When viewing the units in the wp-admin/edit.php post list table, everything is fine. But when I'm updating a unit through the Quick Edit function, the updated row returns with a padded title, like — — Unit 13. While it correctly represents the hierarchy sitewide, the padding is irrelevant in the post list table, as all other units do not have such padded titles. Now those non-hierarchical posts are visually demoted. I would expect to have this behavior only apply to hierarchical post types. (Though the same issue might appear when the site's hierarchy spans beyond that very post type.)

Solution
The solution lies in wp_ajax_inline_save(), where the $level parameter is passed to the display method of the post list table class. I suggest the Two patches are attached to provide a solution. Patch 1 solves this issue just for non-hierarchical post types, and patch 2 extends 1) with only applying $level for the same post type.

Attachments (2)

inline-save.1.diff (949 bytes) - added by Offereins 9 years ago.
Do not apply level for non-hierarchical post types
inline-save.2.diff (1.0 KB) - added by Offereins 9 years ago.
Do not apply level for non-hierarchical post types + limit to current post type

Download all attachments as: .zip

Change History (10)

@Offereins
9 years ago

Do not apply level for non-hierarchical post types

@Offereins
9 years ago

Do not apply level for non-hierarchical post types + limit to current post type

#1 @Offereins
9 years ago

  • Keywords has-patch added

#2 @swissspidy
9 years ago

  • Milestone changed from Awaiting Review to Future Release

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


9 years ago

#4 @chriscct7
9 years ago

  • Owner set to chriscct7
  • Status changed from new to assigned

#5 follow-up: @chriscct7
9 years ago

  • Milestone changed from Future Release to 4.6

I'll clean this patch up on Friday night.

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


9 years ago

#7 in reply to: ↑ 5 @ocean90
9 years ago

@chriscct7 Any news on the refreshed patch?

#8 @ocean90
9 years ago

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

In 37913:

Posts: In wp_ajax_inline_save(), do not apply level for non-hierarchical post types.

Props Offereins.
Fixes #35010.

Note: See TracTickets for help on using tickets.