Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2150,11 +2150,11 @@ function wp_ajax_inline_save() {
}

if ( empty( $data['comment_status'] ) ) {
$data['comment_status'] = 'closed';
$data['comment_status'] = $post['comment_status'];
}

if ( empty( $data['ping_status'] ) ) {
$data['ping_status'] = 'closed';
$data['ping_status'] = $post['ping_status'];
}

// Exclude terms from taxonomies that are not supposed to appear in Quick Edit.
Expand Down
49 changes: 49 additions & 0 deletions tests/phpunit/tests/ajax/wpAjaxInlineSave.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,53 @@ public function test_quick_edit_draft_should_set_publish_date() {

$this->assertSame( '2020-09-11 19:20:11', $post->post_date_gmt );
}

/**
* Quick Edit should not reset ping_status to "closed" for a post type,
* such as "page", that does not render a ping_status control because
* it does not support trackbacks.
*
* @ticket 31977
*
* @covers ::edit_post
*/
public function test_quick_edit_should_not_reset_ping_status_for_post_type_without_trackback_support() {
$this->assertFalse( post_type_supports( 'page', 'trackbacks' ) );

// Become an administrator.
$this->_setRole( 'administrator' );

$page = self::factory()->post->create_and_get(
array(
'post_type' => 'page',
'post_author' => get_current_user_id(),
'ping_status' => 'open',
)
);

$this->assertSame( 'open', $page->ping_status );

// Set up a request. The ping_status field is intentionally omitted,
// as the "page" post type does not render a ping_status control.
$_POST['_inline_edit'] = wp_create_nonce( 'inlineeditnonce' );
$_POST['post_ID'] = $page->ID;
$_POST['post_type'] = $page->post_type;
$_POST['content'] = $page->post_content;
$_POST['excerpt'] = $page->post_excerpt;
$_POST['_status'] = $page->post_status;
$_POST['post_status'] = $page->post_status;
$_POST['screen'] = 'page';
$_POST['post_view'] = 'list';

// Make the request.
try {
$this->_handleAjax( 'inline-save' );
} catch ( WPAjaxDieContinueException $e ) {
unset( $e );
}

$page = get_post( $page->ID );

$this->assertSame( 'open', $page->ping_status );
}
}
Loading