PHPackages                             arraypress/wp-register-quick-edit-fields - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. arraypress/wp-register-quick-edit-fields

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arraypress/wp-register-quick-edit-fields
========================================

Lightweight library for registering custom quick edit fields on WordPress post list tables.

10PHP

Since Feb 1Pushed 3mo agoCompare

[ Source](https://github.com/arraypress/wp-register-quick-edit-fields)[ Packagist](https://packagist.org/packages/arraypress/wp-register-quick-edit-fields)[ RSS](/packages/arraypress-wp-register-quick-edit-fields/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WP Register Quick Edit Fields
=============================

[](#wp-register-quick-edit-fields)

A lightweight library for registering custom quick edit fields on WordPress post list tables.

Features
--------

[](#features)

- Simple API for registering quick edit fields
- Supports posts and custom post types
- Automatic sanitization based on field type
- Auto-generated JavaScript for populating field values
- Permission checking via capabilities
- Multiple field types: text, textarea, number, select, checkbox, url, email
- Callable options for dynamic select values
- No dependencies

Installation
------------

[](#installation)

Install via Composer:

```
composer require arraypress/wp-register-quick-edit-fields
```

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

```
register_quick_edit_fields( 'download', [
    'tax_class' => [
        'label'    => __( 'Tax Class', 'my-plugin' ),
        'type'     => 'select',
        'column'   => 'tax_class',
        'options'  => [
            '0' => __( '— Use Default —', 'my-plugin' ),
            '1' => __( 'Reduced Rate', 'my-plugin' ),
            '2' => __( 'Zero Rate', 'my-plugin' ),
        ],
        'meta_key' => '_tax_class_id',
    ],
    'sale_price' => [
        'label'    => __( 'Sale Price', 'my-plugin' ),
        'type'     => 'number',
        'column'   => 'price',
        'meta_key' => '_sale_price',
        'step'     => '0.01',
    ],
]);
```

### Column Data Attribute Requirement

[](#column-data-attribute-requirement)

For quick edit to populate the current value, your column output must include a data attribute:

```
// In your column callback:
add_filter( 'manage_download_posts_columns', function( $columns ) {
    $columns['tax_class'] = __( 'Tax Class', 'my-plugin' );
    return $columns;
});

add_action( 'manage_download_posts_custom_column', function( $column, $post_id ) {
    if ( $column === 'tax_class' ) {
        $value = get_post_meta( $post_id, '_tax_class_id', true );
        $label = get_tax_class_label( $value );

        // Include data attribute for quick edit JS to read
        printf(
            '%s',
            esc_attr( $value ),
            esc_html( $label )
        );
    }
}, 10, 2 );
```

The data attribute name should match the field key: `data-{field_key}`.

### Field Configuration Options

[](#field-configuration-options)

OptionTypeDefaultDescription`label`string`''`Field label displayed in the UI`type`string`'text'`Field type (see below)`description`string`''`Help text displayed below the field`column`stringField keyColumn to read current value from`options`array|callable`[]`Options for select fields`meta_key`stringField keyThe meta key to save to`min`int|float|null`null`Minimum value for number fields`max`int|float|null`null`Maximum value for number fields`step`int|float|null`null`Step value for number fields`sanitize_callback`callable|null`null`Custom sanitization callback`capability`string`'edit_posts'`Required capability to see/edit field`attrs`array`[]`Additional HTML attributes### Supported Field Types

[](#supported-field-types)

TypeDescriptionAuto-Sanitization`text`Standard text input`sanitize_text_field()``textarea`Multi-line text`sanitize_textarea_field()``number`Numeric input`intval()` or `floatval()` based on step`select`Dropdown selectValidates against options`checkbox`Boolean toggleCast to 0 or 1`url`URL input`esc_url_raw()``email`Email input`sanitize_email()`### Dynamic Options

[](#dynamic-options)

Use a callable to generate options dynamically:

```
register_quick_edit_fields( 'product', [
    'category' => [
        'label'   => __( 'Category', 'my-plugin' ),
        'type'    => 'select',
        'column'  => 'product_cat',
        'options' => function() {
            $categories = get_terms( [
                'taxonomy'   => 'product_cat',
                'hide_empty' => false,
            ] );

            $options = [ '' => __( '— Select —', 'my-plugin' ) ];
            foreach ( $categories as $cat ) {
                $options[ $cat->term_id ] = $cat->name;
            }

            return $options;
        },
        'meta_key' => '_product_category',
    ],
]);
```

### Multiple Post Types

[](#multiple-post-types)

```
register_quick_edit_fields( [ 'post', 'page', 'product' ], [
    'featured' => [
        'label'    => __( 'Featured', 'my-plugin' ),
        'type'     => 'checkbox',
        'column'   => 'featured',
        'meta_key' => '_is_featured',
    ],
]);
```

### Custom Sanitization

[](#custom-sanitization)

```
register_quick_edit_fields( 'product', [
    'price' => [
        'label'             => __( 'Price', 'my-plugin' ),
        'type'              => 'number',
        'column'            => 'price',
        'meta_key'          => '_price',
        'step'              => '0.01',
        'sanitize_callback' => function( $value ) {
            return round( floatval( $value ), 2 );
        },
    ],
]);
```

How It Works
------------

[](#how-it-works)

1. **Render**: Fields are rendered via the `quick_edit_custom_box` hook
2. **Populate**: Auto-generated JavaScript reads data attributes from the row's column and populates the fields
3. **Save**: Values are saved via `save_post_{post_type}` with automatic sanitization

Requirements
------------

[](#requirements)

- PHP 7.4 or later
- WordPress 5.0 or later

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance54

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd6eb8aff0903d87eb674d1ba3c5f3653899c0d7661504eb0deb7798ed86b643?d=identicon)[arraypress](/maintainers/arraypress)

---

Top Contributors

[![arraypress](https://avatars.githubusercontent.com/u/22668877?v=4)](https://github.com/arraypress "arraypress (5 commits)")

### Embed Badge

![Health badge](/badges/arraypress-wp-register-quick-edit-fields/health.svg)

```
[![Health](https://phpackages.com/badges/arraypress-wp-register-quick-edit-fields/health.svg)](https://phpackages.com/packages/arraypress-wp-register-quick-edit-fields)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
