Make WordPress Core

Opened 12 years ago

Last modified 3 months ago

#31977 assigned defect (bug)

Ping status of pages changes to "closed" in quick edit

Reported by: JanVoracek Owned by: pareshradadiya
Priority: normal Milestone: Future Release
Component: Posts, Post Types Version: 4.2
Severity: normal Keywords: good-first-bug dev-feedback has-patch has-unit-tests
Cc: Focuses: administration

Description

WP version: 4.2-beta4

Every page is created with ping_status set to "open". If the page is edited in the "full" edit form, the ping_status remains untouched. However, if the page is edited in the quick edit form, the ping_status field is changed to "closed" since WP 4.2.

Since pages don't support the ping functionality, I suppose it shouldn't change the field. Maybe "closed" is the propper one, but it should be set on the creation.

It makes testing of our plugin a little bit tricky.

Thanks.
Jan

Attachments (3)

31977.diff​ (593 bytes ) - added by pareshradadiya 12 years ago.
Hidden checkbox added when the post_type_supports() check is fail for trackbacks
31977.1.diff​ (2.8 KB ) - added by pareshradadiya 12 years ago.
Checkbox replaced with hidden field and also puted same thing for comment status
31977.2.diff​ (2.9 KB ) - added by pareshradadiya 12 years ago.

Download all attachments as: .zip

Change History (13)

#1 @boonebgorges
12 years ago

  • Keywords needs-patch good-first-bug added
  • Milestone Awaiting Review → Future Release

I've confirmed the bug, but it doesn't look like it's new to 4.2. As far as I can tell, it's worked this way since the current implementation of Quick Edit went into WP. See https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-posts-list-table.php?annotate=blame&marks=1252,1261#L1234 and https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/ajax-actions.php?annotate=blame&marks=1550,1551#L1542 Can you check again to be sure that this was not a problem in 4.1 and earlier?

It looks to me like the simplest fix is to change https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-posts-list-table.php?annotate=blame&marks=1252,1261#L1234 so that when the post_type_supports() checks fail (elseif) a hidden input with the current value will be output to the screen.

@pareshradadiya
12 years ago

Hidden checkbox added when the post_type_supports() check is fail for trackbacks

#2 @pareshradadiya
12 years ago

  • Keywords has-patch added; needs-patch removed

#3 @boonebgorges
12 years ago

  • Keywords needs-patch added; has-patch removed

Thanks for the patch, pareshradadiya. A couple things:

  • Let's use <input type="hidden"> rather than hiding with CSS
  • We should be falling back not on 'open', but on the actual 'ping_status' value for the current post
  • Could you fix the whitespace to match coding standards please? :)

#4 @boonebgorges
12 years ago

(Also, we should do the same thing for comment status, which I believe suffers from the same bug.)

@pareshradadiya
12 years ago

Checkbox replaced with hidden field and also puted same thing for comment status

#5 @pareshradadiya
12 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed

#6 @obenland
11 years ago

  • Owner set to pareshradadiya
  • Status new → assigned

#7 @desrosj
4 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone → Future Release

It looks like this one is still happening.

Every page is created with ping_status set to "open".

I am finding this is not the case currently in 6.0.1, though. I'm not sure if it's because of how my site is set up (it's just a fresh install), or a change somewhere along the way. But every test page I have created with both the block editor and the Classic Editor have had ping_status set to closed. But, if I change it to open and bulk edit the page, the behavior described above is seen.

31977.2.diff​ needs a refresh. @pareshradadiya I know it's been a long time (apologies for this one falling through the cracks), but would you be interested in refreshing the patch?

#8 @desrosj
4 years ago

Related: #25582.

This ticket was mentioned in ​PR #3473 on ​WordPress/wordpress-develop by ​@abozhinov.


4 years ago
#9

  • Keywords has-patch added; needs-patch removed

Did a refresh on the changes applied in the latest patch. ( Added hidden input fields containing comment_status and ping_status, changes about those statuses in the .js file )

Trac ticket: [](https://core.trac.wordpress.org/ticket/31977)

This ticket was mentioned in ​PR #12925 on ​WordPress/wordpress-develop by ​@irozum.


3 months ago
#10

  • Keywords has-unit-tests added

wp_ajax_inline_save() unconditionally defaults comment_status/ping_status to closed whenever those fields are absent from the Quick Edit POST data, on the assumption that an absent value means the checkbox was unchecked. That assumption breaks for post types that don't support comments/trackbacks at all (e.g. page, which supports comments but not trackbacks): the corresponding checkbox is never rendered in the Quick Edit form, so the field is always absent, and every Quick Edit save on such a post type silently resets its ping_status to closed even if it was previously open.

This fixes it by falling back to the post's current comment_status/ping_status (already fetched into $post earlier in the function) instead of hardcoding closed, so a status that Quick Edit has no control for is left untouched rather than being overwritten. This also fixes the same issue for Bulk Edit's "— No Change —" option, which submits the same empty value through the same code path.

Added a PHPUnit test reproducing the bug against the page post type and asserting ping_status is preserved across a Quick Edit save.

## Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Implementation, tests, and PR description. Reviewed by irozum.

Note: See TracTickets for help on using tickets.