Skip to content

Add filter for post statuses in quickedit - Refreshing 36237.patch #9041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
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
53 changes: 39 additions & 14 deletions src/wp-admin/includes/class-wp-posts-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -1986,20 +1986,45 @@ public function inline_edit() {
<label class="inline-edit-status alignleft">
<span class="title"><?php _e( 'Status' ); ?></span>
<select name="_status">
<?php if ( $bulk ) : ?>
<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<?php endif; // $bulk ?>

<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review". ?>
<option value="publish"><?php _e( 'Published' ); ?></option>
<option value="future"><?php _e( 'Scheduled' ); ?></option>
<?php if ( $bulk ) : ?>
<option value="private"><?php _e( 'Private' ); ?></option>
<?php endif; // $bulk ?>
<?php endif; ?>

<option value="pending"><?php _e( 'Pending Review' ); ?></option>
<option value="draft"><?php _e( 'Draft' ); ?></option>
<?php
$inline_edit_statuses = array();
if ( $bulk ) {
$inline_edit_statuses['-1'] = __( '&mdash; No Change &mdash;' );
}
// Contributors only get "Unpublished" and "Pending Review".
if ( $can_publish ) {
$inline_edit_statuses['publish'] = __( 'Published' );
$inline_edit_statuses['future'] = __( 'Scheduled' );
// There is already a checkbox for Private in Single Post Quick Edit. See #63612.
if ( $bulk ) {
$inline_edit_statuses['private'] = __( 'Private' );
}
}

$inline_edit_statuses['pending'] = __( 'Pending Review' );
$inline_edit_statuses['draft'] = __( 'Draft' );
/**
* Filters the statuses available in the Quick Edit UI.
*
* @since 6.9.0
*
* @param array $inline_edit_statuses An array of statuses available in the Quick Edit UI.
* @param string $screen->post_type The post type slug.
* @param bool $bulk A flag to denote if it's a bulk action.
* @param bool $can_publish A flag to denote if the user can publish posts.
*
* @return array $inline_edit_statuses An array of statuses available in the Quick Edit UI.
*/
$inline_edit_statuses = apply_filters( 'quick_edit_statuses', $inline_edit_statuses, $screen->post_type, $bulk, $can_publish );

if ( is_array( $inline_edit_statuses ) ) :
foreach ( $inline_edit_statuses as $inline_status_value => $inline_status_text ) :
?>
<option value="<?php echo esc_attr( $inline_status_value ); ?>"><?php echo esc_attr( $inline_status_text ); ?></option>
<?php
endforeach;
endif;
?>
</select>
</label>

Expand Down
Loading