PHPackages                             kuuak/wordpress-setting-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. kuuak/wordpress-setting-fields

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

kuuak/wordpress-setting-fields
==============================

WordPress setting field functions to output different type of fields

1.2.2(6mo ago)0439↓100%1[5 issues](https://github.com/kuuak/wordpress-setting-fields/issues)MITPHPPHP &gt;=7.2.0

Since Jun 15Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/kuuak/wordpress-setting-fields)[ Packagist](https://packagist.org/packages/kuuak/wordpress-setting-fields)[ RSS](/packages/kuuak-wordpress-setting-fields/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

wordpress-setting-fields
========================

[](#wordpress-setting-fields)

WordPress setting field functions to output different type of fields.

Field Types Summary
-------------------

[](#field-types-summary)

Quick reference to all available field types:

- [Text](#text) - Text input and textarea fields
- [Dropdown](#dropdown) - Select dropdown with custom options
- [Switch (toggle)](#switch-toggle) - Toggle/checkbox switch field
- [Post type (dropdown)](#post-type-dropdown) - Dropdown populated with posts of specified post types
- [Taxonomy (dropdown)](#taxonomy-dropdown) - Dropdown populated with taxonomy terms
- [Pages (dropdown)](#pages-dropdown) - Dropdown populated with WordPress pages
- [Button](#button) - Button field with action support
- [Link (picker)](#link-picker) - Link picker field using WordPress's built-in link modal

Field types
-----------

[](#field-types)

### Text

[](#text)

Name: **Kuuak\\WordPressSettingFields\\Fields::text**

Arguments:

nametypemandatoryDescriptiontypestringfalseOptional. HTML input type attribute or `textarea`. Default: textidstringfalseOptional. Id attribute for the input. Default. the name argumentnamestringtrueName of the inputvaluestringfalseOptional. Current value of the inputrequiredbooleanfalseOptional. Whether the input is required. Default falseplaceholderstringfalseOptional.attrsarrayfalseOptional. Extra html atrributes for the input. Attributes' name are the keys of the associative array.helpstringfalseOptional. Help / description> Example of usage

```
add_action( 'admin_init', function() {
  add_settings_field(
    'my-setting-id',
    __('My setting', 'my-setting-domain'),
    'Kuuak\WordPressSettingFields\Fields::text',
    'setting-page-id',
    'setting-section-id',
    [
      'label_for' => 'my-setting-id',
      'name'      => 'my-setting-name',
      'value'     => 'Value',
      'help'      => 'This is a text to help the user to understand the setting',
      'attrs'     => [
        'class' => 'large-text'
      ],
    ]
  );
} );
```

### Dropdown

[](#dropdown)

Name: **Kuuak\\WordPressSettingFields\\Fields::dropdown**

Arguments:

nametypemandatoryDescriptionidstringfalseOptional. Id attribute for the dropdown. Default. the name argumentnamestringtrueName of the dropdownmultiplebooleanfalseOptional. Define if multiple options can be selected in the list.selectedstringstring\[\]falserequiredbooleanfalseOptional. Whether the dropdown is required. Default falseshow\_option\_allstringfalseOptional. Text to display for showing all items. Default empty.optionsArraytrueArray of dropdown items. Items with keys `value` &amp; `title`.placeholderstringfalsehelpstringfalseOptional. Help / description. Default empty.echobooleanfalseOptional. Whether to echo or return the generated markup. Default true.> Example of usage

```
add_action( 'admin_init', function() {
  add_settings_field(
    'my-setting-id',
    __('My setting', 'my-setting-domain'),
    'Kuuak\WordPressSettingFields\Fields::dropdown',
    'setting-page-id',
    'setting-section-id',
    [
      'label_for' => 'my-setting-id',
      'name'      => 'my-setting-name',
      'selected'  => 'Value',
      'options'   => [
        [ 'value' => 'opt-1', 'title' => 'Option 1' ],
        [ 'value' => 'opt-2', 'title' => 'Option 2' ],
        [ 'value' => 'opt-3', 'title' => 'Option 3' ],
      ],
    ]
  );
} );
```

### Switch (toggle)

[](#switch-toggle)

Name: **Kuuak\\WordPressSettingFields\\Fields::switch**

Arguments:

nametypemandatoryDescriptionidstringfalseOptional. Id attribute for the input. Default. the name argumentnamestringtrueName of the inputcheckedbooleantruehelpstringfalseOptional. Help / descriptionnice\_uibooleanfalseOptional. Display as a nicer ui. Default true.> Example of usage

```
add_action( 'admin_init', function() {
  add_settings_field(
    'my-setting-id',
    __('My setting', 'my-setting-domain'),
    'Kuuak\WordPressSettingFields\Fields::switch',
    'setting-page-id',
    'setting-section-id',
    [
      'label_for' => 'my-setting-id',
      'name'      => 'my-setting-name',
      'checked'   => true,
    ]
  );
} );
```

### Post type (dropdown)

[](#post-type-dropdown)

Name: **Kuuak\\WordPressSettingFields\\Fields::post\_type\_dropdown**

Arguments:

| name | type | mandatory | Description | | --------------- | ------- | --------- | ------------------------------------------------------------------------------------------------------------- | -------- | ----- | ----------------------------------------------------------------- | | query\_args | array | false | WP*Query arguments. \_See WP\_Query::\_\_construct() for accepted arguments* | | name | string | true | Name of the dropdown | | selected | int | string | int\[\] | string\[\] | false | Optional. Value of the option that should be selected. Default 0. | | required | boolean | false | Optional. Whether the dropdown is required. Default false | | placeholder | string | false | Optional. | | show\_option\_all | string | false | Optional. Option all label for the Multiple version. Default `All` | | help | string | false | Optional. Help / description | | echo | boolean | false | Optional. Either to print the dropdown or not. Default true. | | nice\_ui | boolean | false | Optional. Display as a nicer ui. Default true. | | attrs | array | false | Optional. Extra html atrributes for the select input. Attributes' name are the keys of the associative array. |

> Example of usage

```
add_action( 'admin_init', function() {
  add_settings_field(
    'my-setting-id',
    __('My setting', 'my-setting-domain'),
    'Kuuak\WordPressSettingFields\Fields::post_type_dropdown',
    'setting-page-id',
    'setting-section-id',
    [
      'label_for'   => 'my-setting-id',
      'name'        => 'my-setting-name',
      'selected'    => 254,
      'query_args'  => [
        'post_type'   => ['my-custome-post-type'],
        'orderby'     => 'title',
        'order'       => 'ASC',
      ],
       'attrs'     => [
        'class' => 'large-text'
      ],
    ]
  );
} );
```

### Taxonomy (dropdown)

[](#taxonomy-dropdown)

Name: **Kuuak\\WordPressSettingFields\\Fields::taxonomy\_dropdown**

Arguments:

*See WP\_Term\_Query::\_\_construct() for information on additional accepted arguments*

| name | type | mandatory | Description | | --------------- | ------- | --------- | ------------------------------------------------------------------ | -------- | ----- | ----------------------------------------------------------------- | | name | string | true | Name of the dropdown | | taxonomy | string | true | Name of the taxonomy to | | selected | int | string | int\[\] | string\[\] | false | Optional. Value of the option that should be selected. Default 0. | | required | boolean | false | Optional. Whether the dropdown is required. Default false | | show\_option\_all | string | false | Optional. Option all label for the Multiple version. Default `All` | | hide\_empty | string | false | Optional. Option all label | | help | string | false | Optional. Help / description | | echo | boolean | false | Optional. Either to print the dropdown or not. Default true. |

> Example of usage

```
add_action( 'admin_init', function() {
  add_settings_field(
    'my-setting-id',
    __('My setting', 'my-setting-domain'),
    'Kuuak\WordPressSettingFields\Fields::taxonomy_dropdown',
    'setting-page-id',
    'setting-section-id',
    [
      'label_for'   => 'my-setting-id',
      'name'        => 'my-setting-name',
      'taxonomy'    => 'category',
      'selected'    => 254,
    ]
  );
} );
```

### Pages (dropdown)

[](#pages-dropdown)

Name: **Kuuak\\WordPressSettingFields\\Fields::pages\_dropdown**

Arguments:

*See get\_pages() for additional arguments*

| name | type | mandatory | Description | | -------- | ------- | --------- | ------------------------------------------------------------ | ----------------------------------------------------------------- | | name | string | true | Name of the dropdown | | selected | int | string | false | Optional. Value of the option that should be selected. Default 0. | | required | boolean | false | Optional. Whether the dropdown is required. Default false | | help | string | false | Optional. Help / description. Default empty | | echo | boolean | false | Optional. Either to print the dropdown or not. Default true. |

> Example of usage

```
add_action( 'admin_init', function() {
  add_settings_field(
    'my-setting-id',
    __('My setting', 'my-setting-domain'),
    'Kuuak\WordPressSettingFields\Fields::pages_dropdown',
    'setting-page-id',
    'setting-section-id',
    [
      'label_for'   => 'my-setting-id',
      'name'        => 'my-setting-name',
      'selected'    => 25,
    ]
  );
} );
```

### Button

[](#button)

Name: **Kuuak\\WordPressSettingFields\\Fields::button**

Arguments:

nametypemandatoryDescriptionidstringfalseOptional. Id attribute for the button. Default. the name argumentnamestringtrueName of the buttonlabelstringtrueLabel of the buttonvariantstringfalseOptional. Variant of the button. `primary` or `secondary`. Default secondaryactionarrayfalseAction dataaction.namestringtrueAction nameaction.valuestringtrueAction valuewrapper\_attrsarrayfalseOptional. Extra html atrributes for the wrapper. Attributes' name are the keys of the associative array.helpstringfalseOptional. Help / description. Default empty> Example of usage

```
add_action( 'admin_init', function() {
  add_settings_field(
    'my-setting-id',
    __('My setting', 'my-setting-domain'),
    'Kuuak\WordPressSettingFields\Fields::button',
    'setting-page-id',
    'setting-section-id',
    [
      'label_for' => 'my-setting-id',
      'name'      => 'my-setting-name',
      'label'     => 'Register now',
    ]
  );
} );
```

### Link (picker)

[](#link-picker)

Name: **Kuuak\\WordPressSettingFields\\Fields::link**

Renders a link field with WordPress's built-in link picker modal. Allows users to search for internal posts/pages or enter a custom URL. The field stores URL, link text, and target (for "open in new tab") values.

Arguments:

nametypemandatoryDescriptionidstringfalseOptional. Id attribute for the field. Default. the name argumentnamestringtrueName of the field. The field will create sub-fields: `name[url]`, `name[text]`, `name[target]`valuearray|stringfalseOptional. Current value. Can be a string (URL only) or an array with keys: `url`, `text`, `target`. Default empty arrayrequiredbooleanfalseOptional. Whether the URL input is required. Default falsehelpstringfalseOptional. Help / description. Default empty> Example of usage

```
add_action( 'admin_init', function() {
  add_settings_field(
    'my-setting-id',
    __('My setting', 'my-setting-domain'),
    'Kuuak\WordPressSettingFields\Fields::link',
    'setting-page-id',
    'setting-section-id',
    [
      'label_for' => 'my-setting-id',
      'name'      => 'my-setting-name',
      'value'     => [
        'url'    => 'https://example.com',
        'text'   => 'Link Text',
        'target' => '_blank'
      ],
      'help'      => 'Pick a post/page or paste a custom URL.',
    ]
  );
} );
```

> Note: When saving the form, the field will submit as an array with `url`, `text`, and `target` keys. The `target` value will be `_blank` if "open in new tab" is checked, or empty string otherwise.

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.

Release Process
---------------

[](#release-process)

For release instructions, see the `.cursor/rules/release-process.mdc` file. This file contains a cursor rule that can be optionally used to guide the release process.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance68

Regular maintenance activity

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~146 days

Recently: every ~213 days

Total

7

Last Release

188d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dc9905fa4c51c230189fda47f0b6476ec2c4924efc2dceacff3948ac0493b69?d=identicon)[kuuak](/maintainers/kuuak)

---

Top Contributors

[![kuuak](https://avatars.githubusercontent.com/u/6989959?v=4)](https://github.com/kuuak "kuuak (24 commits)")

### Embed Badge

![Health badge](/badges/kuuak-wordpress-setting-fields/health.svg)

```
[![Health](https://phpackages.com/badges/kuuak-wordpress-setting-fields/health.svg)](https://phpackages.com/packages/kuuak-wordpress-setting-fields)
```

###  Alternatives

[salla/zatca

A helper to generate the QR code and signed it for ZATCA e-invoicing

159416.7k2](/packages/salla-zatca)[anthropic-ai/sdk

Anthropic PHP SDK

129134.7k5](/packages/anthropic-ai-sdk)[kylekatarnls/carbonite

Freeze, accelerate, slow down time and many more with Carbon.

22273.2k1](/packages/kylekatarnls-carbonite)[facile-it/facile-coding-standard

Facile.it coding standard

10269.5k28](/packages/facile-it-facile-coding-standard)[qlick/laravel-full-calendar

Laravel helper for FullCalendar.io. Fork of https://github.com/maddhatter/laravel-fullcalendar

1346.3k](/packages/qlick-laravel-full-calendar)

PHPackages © 2026

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