• Stars
    star
    340
  • Rank 123,973 (Top 3 %)
  • Language
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The new Fields API proposal for WordPress Core

WordPress Fields API

WordPress Fields API v0.0.6 Alpha

Travis Scrutinizer Code Quality codecov.io License

The WordPress Fields API can be used by developers to build forms with a common structure. It makes it possible to efficiently build settings pages, meta boxes, profile fields, and other elements in WordPress.

This plugin is an evolving prototype as part of a proposal for inclusion in WordPress core.

This was initially a project of the WordPress core Options/Metadata team but is currently led by Scott Kingsley Clark and Eric Andrew Lewis with oversight by WordPress core lead developer Helen Hou-Sandรญ.

Please note: This Feature Project is still in the early stages of development and should not be used on production sites. It should be assumed that until the v1.0 release, the Fields API could change significantly due to core scrutiny and the final merge proposal response.

Documentation

Visual Structure for Forms, Sections, and Controls

You can add new sections and controls to different sections of WordPress, but we're also in the process of replacing entire admin screens in WordPress with Fields API powered forms too.

Structure Example

Example Code

User Profile Form:

Term Add / Edit Form:

Requirements

  • WordPress 4.4 - No previous or more recent major version can be 100% supported and confirmed as working.
  • Fields API installed as a plugin or included as a library

Every Fields API release has to be based off of the latest WordPress stable release. This means that over time, we can only support the last stable release of WordPress.

At the end of each WP release cycle we have to merge all of the Customizer and other implementations we have with the latest changes from core.

Why a Fields API?

There are over a hundred (I had to stop counting) plugins in the plugin repository that add meta boxes and fields to post types, settings, users, and even more if you include all of the themes and plugins that hook into the customizer. Many plugins build their own abstraction level for doing this, and custom field plugins are the biggest culprit of not following any standards for which to there is a significant need to unite these APIs to make them more consistent. At the same time, being able to provide a detailed structure for a site will take the capabilities of apps that extend WordPress (or interact with it) to the next level.

Each of the APIs that this aims to unite all have the same essential needs. Based on the Customizer, we can enable developers to do more because they won't have to jump between different interfaces.

What about Fields UI?

I am not focusing on any UI aspects at the moment besides implementation of the API underneath getting the field data for UI to use in core itself. It will be easier to tackle the API and the UI separately for both the purpose of development and core inclusion.

Where we need help

There are still a lot of areas the API is not represented in code or in examples.

Check out a full list of things we currently need help with

Contributing

If you are interested in contributing, feel free to contact us in #core-fields on WordPress Slack and we'll help you get into the mix.

There are also GitHub issues you can feel free to chime in on or provide Pull Requests to.

Pull Requests

To submit a pull request, please base it off of the develop branch which we use for ongoing development towards the next release. The master branch represents the last stable beta release.

Testing

There are a few things that can be enabled for testing purposes:

  • define( 'WP_FIELDS_API_EXAMPLES', true ); Enable example section, controls, and fields for each form.
  • define( 'WP_FIELDS_API_TESTING', true ); Enable Fields API testing, as used by below.
  • ?fields-api-memory-test=1 Enable memory testing of 25 example sections, set to any number greater than 1 to customize how many example sections to add. Requires WP_FIELDS_API_TESTING on
  • ?no-fields-api=1 Disable Fields API from loading, useful for memory split testing. Requires WP_FIELDS_API_TESTING to be turned on
  • ?no-fields-api-late-init=1 Disable Fields API Late Init, which means when any form, section, control, or field are added, the object will be setup right away instead of only as needed by current page. Useful for memory split testing. Requires WP_FIELDS_API_TESTING to be turned on

Related Plugins

There are also a few other related plugins that may come in handy:

  • WP Fields Admin UI plugin: Build and demo how the Fields API works with an easy to use administration interface that actually lets you create new Fields API configurations.
  • WP Fields API Debug Bar plugin: See details on how many forms, sections, controls, fields, and other stats about your current Fields API configuration.

LICENSE

GPLv2 or later. See License.

More Repositories

1

cache-wp-query

Cache posts from WP_Query in an automatic wrapper for WP_Query, avoid extra DB requests. Integrates with ElasticPress to cache those requests too! NEW: Use WP 6.1 for better built-in WP_Query caching!
PHP
34
star
2

papertrail

Papertrail Logging API for WordPress
PHP
25
star
3

wp-admin-ui

A PHP class to build Admin interfaces within the WordPress Dashboard -- includes tables, add/edit forms, sorting, filtering, and exporting
PHP
25
star
4

wp-custom-comment-types

WordPress Custom Comment Types - A feature as a plugin with a few core mods, built with the hopes of inclusion in core.
PHP
23
star
5

exports-and-reports

Define custom exports / reports for users by creating each export / report and defining the fields as well as custom MySQL queries to run.
PHP
18
star
6

ghost-meta

Ghost meta allows you to store multiple meta values in a single meta record, with an API that mirrors the Metadata API. It integrates with ElasticPress to expand all ghost meta so Elasticsearch can query as normal meta too.
PHP
17
star
7

debug-wp-redirect

Stops and outputs information about redirects done on the front of a site and in the admin area with wp_redirect() and wp_safe_redirect().
PHP
16
star
8

wp-post-locking

Drop-in post locking for WordPress on the frontend
PHP
15
star
9

wordpress-fields-admin-ui

A proof of concept Administration UI for the WP Fields API https://github.com/sc0ttkclark/wordpress-fields-api
PHP
12
star
10

local-reset-site-add-on

Local Reset Site Addon
JavaScript
11
star
11

jquery-conditions

jQuery Conditions is a new project aiming at providing conditional rule handling for form fields including show/hide/message/validation handling.
PHP
10
star
12

filters

A new plugin for WordPress that lets you use an enhanced UI for your post types search/filtering to really clean up the experience.
PHP
9
star
13

gravity-forms-bluepay

Gravity Forms BluePay Payment Gateway Add-on
PHP
7
star
14

term-capabilities

Term Capabilities plugin for WordPress
PHP
7
star
15

crony

Create and Manage Cronjobs in WP by loading Scripts via URLs, including Scripts, running Functions, and/or running PHP code. This plugin utilizes the wp_cron API.
PHP
5
star
16

wporg-replace

A helpful GitHub action that will handle replacing version numbers across plugin files.
4
star
17

admin-bar-disabler

Admin Bar Disabler plugin for WordPress
PHP
4
star
18

stats-goals-for-give

Stats and Goals for GiveWP
2
star
19

acknowledge-me

Shows contributors to a Github repo
PHP
2
star
20

sc0ttkclark

My GitHub Profile
2
star
21

dps-entitlement-integration

Adobe DPS Direct Entitlement Integration for WordPress
PHP
2
star
22

skcdev-edd-stats

Just the stats I want, maybe you want them too
PHP
2
star
23

sticky-admin-menu

Description: A simple plugin that sets the current admin page to always be at the top of the admin menu.
PHP
2
star
24

skcdev-givewp-stats

PHP
1
star
25

wordpress-fields-api-debug-bar

Debug Bar information for the WP Fields API
PHP
1
star
26

wordpress-fields-api-2017

Fields API proposal for WordPress Core (2015-2017), new proposal is at https://github.com/sc0ttkclark/wordpress-fields-api
PHP
1
star
27

wporg-replace-helper

A set of scripts that help with replacing version numbers and other text for a WordPress.org plugin.
1
star