Make WordPress Core

Changeset 60512

Timestamp:
07/25/2025 03:15:48 PM (4 months ago)
Author:
johnbillion
Message:

Posts, Post Types: Add a filter to the post statuses available in Quick Edit and Bulk Edit.

Props kakomap, SirLouen, iamadisingh, mukesh27

Fixes #36237

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r60216 r60512  
    19871987                            <span class="title"><?php _e( 'Status' ); ?></span>
    19881988                            <select name="_status">
    1989                                 <?php if ( $bulk ) : ?>
    1990                                     <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
    1991                                 <?php endif; // $bulk ?>
    1992 
    1993                                 <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review". ?>
    1994                                     <option value="publish"><?php _e( 'Published' ); ?></option>
    1995                                     <option value="future"><?php _e( 'Scheduled' ); ?></option>
    1996                                     <?php if ( $bulk ) : ?>
    1997                                         <option value="private"><?php _e( 'Private' ); ?></option>
    1998                                     <?php endif; // $bulk ?>
    1999                                 <?php endif; ?>
    2000 
    2001                                 <option value="pending"><?php _e( 'Pending Review' ); ?></option>
    2002                                 <option value="draft"><?php _e( 'Draft' ); ?></option>
     1989                                <?php
     1990                                $inline_edit_statuses = array();
     1991                                if ( $bulk ) {
     1992                                    $inline_edit_statuses['-1'] = __( '&mdash; No Change &mdash;' );
     1993                                }
     1994                                // Contributors only get "Unpublished" and "Pending Review".
     1995                                if ( $can_publish ) {
     1996                                    $inline_edit_statuses['publish'] = __( 'Published' );
     1997                                    $inline_edit_statuses['future']  = __( 'Scheduled' );
     1998                                    // There is already a checkbox for Private in Single Post Quick Edit. See #63612.
     1999                                    if ( $bulk ) {
     2000                                        $inline_edit_statuses['private'] = __( 'Private' );
     2001                                    }
     2002                                }
     2003
     2004                                $inline_edit_statuses['pending'] = __( 'Pending Review' );
     2005                                $inline_edit_statuses['draft']   = __( 'Draft' );
     2006
     2007                                /**
     2008                                 * Filters the statuses available in the Quick Edit and Bulk Edit UI.
     2009                                 *
     2010                                 * @since 6.9.0
     2011                                 *
     2012                                 * @param array<string,string> $inline_edit_statuses An array of statuses available in the Quick Edit UI.
     2013                                 * @param string               $post_type            The post type slug.
     2014                                 * @param bool                 $bulk                 A flag to denote if it's a bulk action.
     2015                                 * @param bool                 $can_publish          A flag to denote if the user can publish posts.
     2016                                 */
     2017                                $inline_edit_statuses = apply_filters( 'quick_edit_statuses', $inline_edit_statuses, $screen->post_type, $bulk, $can_publish );
     2018
     2019                                foreach ( $inline_edit_statuses as $inline_status_value => $inline_status_text ) :
     2020                                    ?>
     2021                                    <option value="<?php echo esc_attr( $inline_status_value ); ?>"><?php echo esc_attr( $inline_status_text ); ?></option>
     2022                                    <?php
     2023                                endforeach;
     2024                                ?>
    20032025                            </select>
    20042026                        </label>
Note: See TracChangeset for help on using the changeset viewer.