Fields API chat summary – October 5th, 2015

Present: @sc0ttkclark, @nicholas_io, @tomharrigan, @ericlewis, @potatomaster

Logs: https://wordpress.slack.com/archives/core-fields/s1444021200000000

  • I just got 100 hours from 10up to work on Fields API!
  • I will be working on getting the WP 4.3 CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. changes put into the Fields APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways., my first pass doesn’t have unit tests passing yet
  • We’ll be fleshing out Control classes, based on Customizer control classes and expand the main control class into individual classes as opposed to a ‘switch’
  • We laid out a few implementations we’d like to get into prototyping
    • User profile fields (piggy backing existing UIUI User interface of section heading + fields) @sc0ttkclark
    • Settings API (cue the oooh’s and aaah’s sound effect) @sc0ttkclark
    • Post editor (metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. boxes + fields) @tomharrigan
    • WidgetWidget A WordPress Widget is a small block that performs a specific function. You can add these widgets in sidebars also known as widget-ready areas on your web page. WordPress widgets were originally created to provide a simple and easy-to-use way of giving design and structure control of the WordPress theme to the user. forms @nicholas_io
    • Future: Term editor (sections + fields)
    • Future: Comment forms?
  • We want to improve the main Fields API readme to better explain the project, offer more links to information about the Customizer API since it’s what we based the Fields API on, and flesh out more examples
  • We need more examples, so any use-cases we can put together for any object type, would be handy to start putting that code together (structures, not custom implementations or overrides)

We certainly could use additional contributors involved with the project, especially as we seek to start more implementation prototypes of how things could work. Just hop into SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. #core-fields or check out our Github repo. Over the next 5 weeks my involvement in the project will be greatly increased, so if you are going to get involved — now would be the right timing!

Next chat: Monday 20:00 UTC 2015 (every Monday)

#chats, #feature-plugins, #fields-api, #meeting-notes, #options-meta

Fields API: Request for review of direction

Over the past many months this year, I have been working with guidance from @helen on the new Fields APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. with the intention of inclusion into WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.. It’s based on the CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. API, so those who have experience with it will see a lot of similarities. The goal isn’t to create a duplicate API though, and in our proposal we would be implementing the Fields API within the Customizer API.

What does that bring to core as a whole? It gives core a very real and far reaching API to add fields to any type of object in a standard interface. Given the growth of the Customizer API and its inclusion of fields, @helen and I both agreed it’d be great to leverage everything it can do in our efforts here. The goal isn’t focused on the actual Customizer UIUI User interface or editing on the front-end, it’s all data-oriented.

We would create implementations behind the scenes in the various existing APIs such as the Customizer API (now) and Settings API (later) while maintaining backwards compatibility. We’re also hoping to implement the Fields API within the User profile screen. This would give core more flexibility towards revamping the User profile screen in the future, without having to tackle even more than just a UI refresh. That’s also not mentioning the fact that pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party and theme authors could leverage this API to extend WordPress with their own fields in the various areas. Future places we’d look at integrating Fields API with would be the Post editor, which I’ve pegged as our third focus, behind User profile fields and the Customizer API.

Anyways, that leads us to the point we’re at now, we have an API but we don’t have all of the built-in Field Types (control types) yet or the latest Customizer API changes from 4.3 merged upstream into the Fields API. There are unit tests that are running (and passing!) so that is going to help us on our road towards core for sure.

We need developers to give their feedback on the direction we’re heading. Here are the relevant links for those reviewing:

I’d love more feedback from anyone contributing to WordPress, or the *countless* plugin and theme developers who would use the Fields API. Please comment on this post, or if you’d like to discuss further, you can hop into our weekly meetings on Mondays (Monday 20:00 UTC 2015) in the WP SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. #core-fields channel, or pingPing The act of sending a very small amount of data to an end point. Ping is used in computer science to illicit a response from a target server to test it’s connection. Ping is also a term used by Slack users to @ someone or send them a direct message (DM). Users might say something along the lines of “Ping me when the meeting starts.” me there anytime.

Update – 08/10/2015:

We now also have a growing list of developers who are behind this project and would implement it in their projects if it were merged into core.

#fields-api, #options-meta

get_transient() is now more strict in 4.3

WordPress 4.3 includes a change to get_transient(). As reported in #23881 and #30380, get_transient() had a check for get_option( $transient_timeout ) < time().

Because get_option() can return false and false is always < time() 😖, get_transient() could delete transient timeout options in an unexpected way or cause two more unnecessary queries.

WordPress 4.3 now checks the return value first before comparing with the current time. This means that WordPress will no longer delete broken transients via get_transient() if you have only deleted the timeout option. See [33110].

If you have to delete a transient manually, please make sure that you’re deleting _transient_timeout_$transient and '_transient_' . $transient. (Hint: Transients can be stored in an external object cache too.)

See also: the Transients API Codex page.

#4-3, #dev-notes, #options-meta

Metadata API project reborn: The new Fields API project

Many of you will remember that a couple of years ago, @ericlewis and a group of us set out to start a project to make sense of all of the different APIs that arose from third party plugins and themes to build custom fieldCustom Field Custom Field, also referred to as post meta, is a feature in WordPress. It allows users to add additional information when writing a post, eg contributors’ names, auth. WordPress stores this information as metadata. Users can display this meta data by using template tags in their WordPress themes. solutions on top of WordPress. That project was nicknamed “Metamorphosis” and subsequently went by the “Metadata UIUI User interface/APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways.” project. As pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party authors dealing with and using custom fields and content types, we had been tackling the issues of developing for multiple object types in WordPress for years prior to getting together.

Now, @helen and I are pleased to (re)introduce to you what we’re hoping to be the fruits of all of this labor: Meet the new Fields API project.

function fields_api_example_post_field_register( $wp_fields ) {

   // 1. Define a new section (meta box) for fields to appear in
   $wp_fields->add_section( 'post_type', 'my_cpt', 'my_meta_box',
      array(
         // Visible title of section
         'title'       => __( 'My Meta Box', 'mytheme' ),

         // Determines what order this appears in
         'priority'    => 'high',

         // Determines what order this appears in
         'context'     => 'side',

         // Capability needed to tweak
         'capability'  => 'my_custom_capability'
      )
   );

   // 2. Register new fields
   $wp_fields->add_field( 'post_type', 'my_cpt', 'my_custom_field',
      array(
         // Default field/value to save
         'default'    => 'All about that post',

         // Optional. Special permissions for accessing this field.
         'capability' => 'my_custom_capability',

         // Optional. Add an associated control (otherwise it won't show up in the UI)
         'control' => array(
            // Don't set 'id' and it will automatically be generated for you as
            'id' => 'mysite_my_custom_field',

            // Admin-visible name of the control
            'label'   => __( 'My Custom Field', 'mytheme' ),

            // ID of the section this control should render in (can be one of yours, or a WordPress default section)
            'section' => 'my_meta_box',

            // Control type
            'type'    => 'text'
         )
      )
   );

}
add_action( 'fields_register', 'fields_api_example_post_field_register' );

(Please note: The code above may not be the same as the final implementation, it will especially change over the next few weeks)

First of all, we split off the UI side of the project to focus solely on the API. This way, we’re not held up by anything as we move towards implementation inside of coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.. We can tackle each UI separately and that helps us keep the project nimble and on track.

The goals of this new API proposal will be to be implemented across WordPress objects as an API to register fields and sections for. We aim to cover these objects (not necessarily in this order):

  • CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. (retrofitting it beneath the existing Customizer API)
  • User profile screen
  • Post editor
  • Settings screens (retrofitting it beneath the existing Settings API)
  • And other areas in the future (Comment editor, Networknetwork (versus site, blog) Settings screens [see #15691], Media modals, etc)

This API offers a great deal of standardization across all of WordPress and code reusability. It’s paramount for third-party developers, who will be able to utilize these structures in their own plugins and themes, build apps and give access to other developers so they can contextually see what a site really contains. I see the biggest use-case being able to expose the entirety of WordPress to the REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/. and giving apps like the WordPress iOSiOS The operating system used on iPhones and iPads. app access to metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. boxes and custom fields to display real editor screens with field inputs based on the control types natively.

Areas we need help currently:

  • Examples and use cases for Customizer, User profile screen, Post editor, and Settings screens (submit issues in GitHubGitHub GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged be the repository owner. https://github.com/ with your ideas, coordinate with us to refine them if you want)
  • Unit tests for core
  • Testing Customizer implementation, you’ll find the core files to replace under the /implementations/ folder in the repo
  • Brainstorming implementation classes for other object types to implement in the UI, starting with User profile screen

If you’re interested in joining our merry crew which includes @helen and a few of us, hop into SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. #core-fields and join our weekly meetings every Monday (Monday 20:00 UTC 2015). You can check out the Fields API and submit PRs on GitHub, or pingPing The act of sending a very small amount of data to an end point. Ping is used in computer science to illicit a response from a target server to test it’s connection. Ping is also a term used by Slack users to @ someone or send them a direct message (DM). Users might say something along the lines of “Ping me when the meeting starts.” us in #core-fields throughout the week with questions or concerns.

#customize, #fields-api, #options-meta, #team-update

WP Metadata UI / API project update and new meeting time/place

It’s been a few weeks since we’ve posted an update, @mikeschinkel has been working hard on some new commits to give us some shortcuts for option arrays and things have stabilized there finally. We’re now focused on documenting field type development so we can get some contributors in there fleshing out the remaining field types.

We are also moving our “Office Hours” time and place, to Mondays @ 1800 UTC , but instead of IRCIRC Internet Relay Chat, a network where users can have conversations online. IRC channels are used widely by open source projects, and by WordPress. The primary WordPress channels are #wordpress and #wordpress-dev, on irc.freenode.net. where people can’t sync up and collaborate, we’re moving it to our public Gitter room. Some other WP projects are using it and we’ve found it incredibly helpful to keep up with GitHubGitHub GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged be the repository owner. https://github.com/ activity along with chat that can happen at all times of the day and it sticks around for you to read anytime you want to.

Our Gitter chat can be found here: https://gitter.im/wordpress-metadata/metadata-ui-api

Anyone can see the chat messages, and if you want to participate it’s just a GitHub login away. They have iOSiOS The operating system used on iPhones and iPads. / Mac apps too, so that’s helpful to some people as well.

If you’re interested in contributing, or if you want to check out what we’ve got and need some insight, just pingPing The act of sending a very small amount of data to an end point. Ping is used in computer science to illicit a response from a target server to test it’s connection. Ping is also a term used by Slack users to @ someone or send them a direct message (DM). Users might say something along the lines of “Ping me when the meeting starts.” us — anytime — in Gitter 🙂

#fields-api, #options-meta

WP Metadata API / UI office hours this Friday

We will continue our weekly meetings this Friday. As no other suggestions have been made, it will remain at 18:00 UTC on Fridays in #wordpress-coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.-plugins on Freenode IRCIRC Internet Relay Chat, a network where users can have conversations online. IRC channels are used widely by open source projects, and by WordPress. The primary WordPress channels are #wordpress and #wordpress-dev, on irc.freenode.net..

We may be transitioning from meeting into office hours as we haven’t had as many contributors joining us at the meetings as we had hoped. We will continue developing some awesomeness over at https://github.com/wordpress-metadata/metadata-ui-api

Feel free to hop into the issues and take ownership of new field types or documentation. We’re also looking for help with styling of the form fields and JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. in relation to support for repeatable fields.

#fields-api, #options-meta

WP Metadata API / UI team meeting hours vote

It was brought up that our current meeting time at 18:00 UTC on Fridays in #wordpress-coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.-plugins on Freenode IRCIRC Internet Relay Chat, a network where users can have conversations online. IRC channels are used widely by open source projects, and by WordPress. The primary WordPress channels are #wordpress and #wordpress-dev, on irc.freenode.net. is not necessarily the best for everyone.

What day would be better? Around what time would be better?

This week’s meeting will continue as planned at the existing time on Friday, but next Friday’s meeting will be postponed due to a scheduling conflictconflict A conflict occurs when a patch changes code that was modified after the patch was created. These patches are considered stale, and will require a refresh of the changes before it can be applied, or the conflicts will need to be resolved. with @mikeschinkel and I.

#fields-api, #options-meta

We’re ready for more contributors to join us on the WP Metadata UI / API project

Where we need help most

  • Field Types – We need help building new field types, we currently have a few basic fields to start off with including the Text, Textarea, URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org, Date, and Hidden field types.
  • Actions / Filters – We are now seeking to add in the hooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same. necessary to extend things further, feel free to request hooks anywhere you see a need for them.
  • Repeatable Fields – We are architecting a solution for repeatable fields, in which you can take a single field and make it have repeatable inputs that let someone add multiple values. These values would be stored in multiple metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. values for the same meta key for the specific object ID.
  • Unit Testing – If your UT fu is strong, then strong would the use of your fu be on our team!

Have any other ideas you’d like to help out with? Hop in, the world is your oyster and we’re eager to help you get those pearls!

Join us in #wordpress-coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.-plugins on Freenode IRCIRC Internet Relay Chat, a network where users can have conversations online. IRC channels are used widely by open source projects, and by WordPress. The primary WordPress channels are #wordpress and #wordpress-dev, on irc.freenode.net. and seek out @sc0ttkclark or @mikeschinkel if you need anything to help you get started, or open up an issue on our GitHub with your questions/feedback.

We’re also still meeting 18:00 UTC on Fridays in #wordpress-core-plugins on Freenode IRC, feel free to search IRC logs for <#metadata> for a history of our previous conversations.

So… ready to start? Head over to the WordPress Metadata UI / API GitHub now, see you there! Happy coding!

#fields-api, #options-meta

Metadata UI / API status update

We’ve been hard at work the past many weeks on getting something ready for contributors to start adding their PR’s against. @mikeschinkel took the helm for the initial base, after many discussions came up with a brilliant first code PR to the project. In our Friday meeting, we presented the PR and merged it into the official master for the project.

You can start browsing through it now over at: https://github.com/wordpress-metadata/metadata-ui-api

Some notable items from this initial first draft:

  • Global functions to access class/method based architecture (register_*)
  • register_post_form( ‘meta_box_name’, ‘post_type’, $args ) — Add new forms to a post type (like metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. boxes)
  • register_post_field( ‘meta_key’, ‘post_type’, $args ) — Add new fields to a post type
  • Initial support to expand the APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. for use with Comment types, Option Groups, and Users
  • Support for custom object types that aren’t WP object types, like for plugins that have their own custom tables
  • Very efficient registration limits ‘fixups’ until fields are called, so registering hundreds of fields won’t detrimentally affect timing (confirmed by initial benchmarking)
  • Storage handling broken up into meta, options, taxonomyTaxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies. terms, can be extended by plugins to add additional storage options (like in Pods, we have custom tables/columns available for custom fields)
  • WP_Html_Element class methods handle htmlHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. element building and auto-sanitization for attributes

Our next steps are to continue testing the API and start having contributors join in (read: yes, YOU!). We’d like to start getting PR’s that add new field types and start working on unit testing next.

Also, a call-out to our UIUI User interface / JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. team, we’re ready for you now 🙂

#fields-api, #options-meta

Metadata API/UI Meeting 04/11

As discussed in the previous meetings, we’re pushing the time back one hour from 19:00 UTC to the new time at 18:00 UTC on Fridays. We’ll be in #wordpress-coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.-plugins tomorrow, April 11th, 2014 as usual.

We will be talking about the progress on form and field registration and move into some new modeling oriented based on objects (post types) instead of forms as previously discussed.

See you all there!

#fields-api, #options-meta