The WordPress coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. development team builds WordPress! Follow this site for general updates, status reports, and the occasional code debate. There’s lots of ways to contribute:
Found a bugbugA bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority.?Create a ticket in the bug tracker.
Almost 8 years ago the Preferred Languages feature project was kicked off in response to a feature requestfeature requestA feature request should generally begin the process in the ideas forum, on a mailing list, as a plugin, or brought to the attention of the core team, such as through scope meetings held for each major release. Unsolicited tickets of this variety are typically, therefore, discouraged. in #28197. Right now it is probably the oldest active feature pluginFeature PluginA plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See Features as Plugins.. Over time there were numerous updates, bugbugA bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. fixes, and even a complete refactor. Preferred Languages was always built and maintained with the goal in mind to merge it into coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. one day. Now the time is finally right to do so.
Purpose & Goals
As a quick reminder, Preferred Languages replaces the existing languages dropdown with a supercharged version that lets you select multiple preferred languages. WordPress then tries to load the translations for the first language that’s available, falling back to the next language in your list otherwise. Without this, WordPress would just fall back to English (US) in such cases, which is not a great experience. Such a UIUIUser interface is a pretty standard feature that can be seen for example also in operating system and browser settings.
Note: Preferred Languages works for both the site language (can be set at Settings -> General) and the user language (can be set in the profile).
Project Background
You may wonder why it took such a long time. Since the project’s inception, a lot has changed in WordPress. For example, GutenbergGutenbergThe Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ happened. That’s why Preferred Languages saw a complete rewrite using the same ReactReactReact is a JavaScript library that makes it easy to reason about, construct, and maintain stateless and stateful user interfaces. https://reactjs.org/. components that also power the blockBlockBlock is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. editor. With Gutenberg we also saw the introduction of JavaScript localization, which required further iterations to Preferred Languages. Then there was a need for merging incomplete translations, reducing the chances that you see missing strings in English. However, merging translations was very bad for performance, as it involves loading lots of translationtranslationThe process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. files. In WordPress 6.5 we finally completely replaced the localization library with a more performant solution that natively supports loading multiple files at once. So this last remaining blockerblockerA bug which is so severe that it blocks a release. is now finally resolved!
Internationalization and localization is a core part of WordPress and relevant for more than half of all users. That’s why this functionality belongs natively into WordPress core and not in a (canonical) plugin. Merging Preferred Languages into core would allow the fallback logic to run much closer to where translation loading happens, reducing the risk for bugs and pluginPluginA 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 incompatibilities. Plus, the UI impact is minimal, as it simply expands an existing language dropdown with additional features.
Implementation Details
The UI is built using TypeScript and React and the @wordpress/* npm packages also used for Gutenberg. This makes for a consistent look & feel and will make it easy to integrate it into any revamped WordPress adminadmin(and super admin) UI. The back end parts were developed in such a way that merging them into core eventually is as straightforward as possible, so a patchpatchA special text file that describes changes to code, by identifying the files and lines which are added, removed, and altered. It may also be referred to as a diff. A patch can be applied to a codebase for testing. can be developed relatively quickly.
Preferred Languages has been tested in production websites over numerous years by thousands of users. It works in all major browsers supported by WordPress, follows accessibilityAccessibilityAccessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both “direct access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility) best practices, and gracefully falls back to the old single language dropdown if JavaScriptJavaScriptJavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. is disabled.
Contributors and Feedback
While I (@swissspidy) have been the lead developer of the plugin, valuable input and contributions have come from others in the community.
This is a proposal and is subject to revision based on your feedback. If you haven’t already tried out the plugin, please download and install it from WordPress.orgWordPress.orgThe community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/ or the comfort of your WordPress admin. You can review the current code and leave feedback at the project’s GitHub repository or in #core-i18n on SlackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/..
All feedback will be collected over the next couple of weeks. After that, the received feedback will be discussed and next steps determined. The goal is to work on and land a patch quickly to ensure that the feature gets plenty of testing in WordPress trunktrunkA directory in Subversion containing the latest development code in preparation for the next major release cycle. If you are running "trunk", then you are on the latest revision..
View the kickoff post, the status update post, and the Trac ticket for the Interactivity APIAPIAn 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..
Purpose & Goals
Currently, pluginPluginA 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 implement their chosen JavaScriptJavaScriptJavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. frameworks (or vanilla JSJSJavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors.) to enhance user experiences on WordPress sites. There is no consistency or standardized pattern for developing frontend JavaScript in WordPress.
The Interactivity API provides a standard way for developers to add interactions into the frontend of their blocks.
The API has been designed and created with these requirements:
BlockBlockBlock is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience.-first and PHPPHPThe web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher-first. Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.
Backward compatible. Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooksHooksIn 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. and internationalization.
Declarative and reactive. Utilizing declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.
Performant: Optimizing runtime performance to deliver a fast and lightweight user experience.
Send less JavaScript. Reduce the overall amount of JS being sent on the page by providing a common framework that blocks can reuse. So the more that blocks leverage the Interactivity API, the less JS will be sent overall.
A live demo of what can be achieved was announced in the State of the WordState of the WordThis is the annual report given by Matt Mullenweg, founder of WordPress at WordCamp US. It looks at what we’ve done, what we’re doing, and the future of WordPress. https://wordpress.tv/tag/state-of-the-word/..
In WordPress 6.4,the Image, Search, File, Navigation, and Query coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. blocks were refactored using the private version of the Interactivity API, addressing accessibilityAccessibilityAccessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both “direct access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility) issues and adding the long-time expected lightbox (or “expand on click”) feature for images.
The development has been done in GutenbergGutenbergThe Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/, using a Tracking Issue to monitor progress and a Discussions category to solicit feedback and offer guidance to developers who assisted in testing.
Implementation Details
The Interactivity API is a standard system of directives, based on declarative code, for adding frontend interactivity to blocks.
Directives are special HTMLHTMLHyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. attributes that tell the Interactivity API to attach a specified interaction to a DOM element or to transform it, similar to HTMX or AlpineJS. Using HTML as the templating language enables the API to understand the directives both in the server (PHP) and in the client (JS).
As part of this project, and all the interactivity scripts are now implemented leveraging the new script modules which are also shipping in WordPress 6.5. All of them will only be loaded on the frontend if at least one interactive block is present, to avoid sending unnecessary JavaScript to the frontend.
Here is an example of an interactive block, with a JavaScript file in charge of increasing or decreasing a counter, and a PHP file in charge of counter initialization and rendering.
For developers looking to get started, there is a Getting Started guide available, with plans to transition it to a handbook in the near future.
Additionally, a detailed dev notedev noteEach important change in WordPress Core is documented in a developers note, (usually called dev note). Good dev notes generally include a description of the change, the decision that led to this change, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase. will be released, providing further insights into utilizing the API and understanding its internal workings.
JavaScript modules have transformed the way developers write and organize JavaScript code. They provide a cleaner and more modular architecture, making code easier to maintain, test and reuse across projects.
With the addition of native support for registering and enqueueing JavaScript modules, WordPress can keep pace with web development by using efficient, effective and battle-tested methods to handle JavaScript libraries and their dependencies.
There will be another dev note about JavaScript Modules and a guide to use them.
The Interactivity API is intended to be a long-term project with future enhancements; feedback is highly welcome. The best way to reach out is via GitHub Discussions.
Code and documentation contributions are also welcomed, and the Gutenberg repository is the place to go.
Some examples of contributing could be:
Test the Interactivity API, create your own interactions, and share feedback about what you like and you don’t.
Suggest new features to include in the API.
Help creating tutorials or share demos that can inspire other people.
Spread the word
The more developers who use Interactivity API in their projects, the more consistency there will be in the WordPress ecosystem, and the less JavaScript will be sent to the world!
Feel free to spread the word about the Interactivity API in social media and events with your colleagues, friends, and everyone!
Note: This post was updated to add the “Third-party plugins not hosted on WordPress.orgWordPress.orgThe community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/” section. 15th February, 2024 – @costdev
View the kickoff post, the Trac ticket and the feature plugin for PluginPluginA 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 Dependencies.
Purpose & Goals
Extensibility of WordPress through plugins and the HooksHooksIn 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.APIAPIAn 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. is one of its most beneficial features. There are many plugins that act purely as extensions of others, building functionality on top. The Plugin Dependencies feature aims to make the process of installing/activating addons (dependents) and the plugins they rely on (dependencies) consistent and easy to use.
Plugin authors are currently implementing their own ways of informing users about other plugins that they depend on. The implementations are inconsistent and sometimes incomplete. Users are often left to search for and install the other required plugins themselves.
The feature does not intend to replace the need for defensive coding within dependent plugins, or ensure version compatibility with their dependencies; nor does it seek to mitigate the vast array of potential plugin interactions. For WordPress and/or PHPPHPThe web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher incompatibilities, CoreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. already has handling for preventing installing, updating, or activating plugins with unmet requirements.
Implementation Details
A plugin’s dependencies can be declared by the use of a new Requires PluginsheaderHeaderThe header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. in the dependent plugin’s main file. This must contain a comma-separated list of WordPress.org slugs for its dependencies, such as jetpack (jetpack/jetpack.php is not supported). It does not support commas in plugin slugs.
Example
/** * Plugin Name: Bridge for Foo and Bar * Requires Plugins: foo, bar */
Version management support, such as providing specific minimum and maximum version numbers through the Requires Plugins header value, is not currently supported.
Requirements
Declaring a plugin dependency places the following requirements:
Bridge for Foo and Bar can only be installed once Foo and Bar have been installed.
Bridge for Foo and Bar can only be activated once Foo and Bar have been activated.
Foo and Bar can only be deactivated once Bridge for Foo and Bar has been deactivated.
Foo and Bar can only be deleted once Bridge for Foo and Bar has been deleted.
Viewing, installing and activating dependencies
In the Plugins > Add New screen, dependencies are listed in the dependent’s plugin card. Next to these is a View Details link to open a dependency’s information modal. The dependency can be installed and activated using the buttons in the modal’s footer.
Previously, the modal would close upon clicking the Install Now or Activate button. The feature makes the modal persistent, and the buttons used in the plugin cards and modal now use the same underlying markup and functionality for consistency and reduced maintenance burden.
The side effect of this shared functionality is that automatic redirection upon activating a plugin from Plugins > Add New is no longer available. This has the benefit of not redirecting a user away from the Plugins > Add New screen for each plugin, removing them from their current context. Users can therefore install and activate multiple plugins without leaving their current context.
For plugins with onboarding experiences, they often have additional logic in case a plugin is installed and activated through a tool such as WP-CLIWP-CLIWP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/https://make.wordpress.org/cli/, so that the user is still presented with the onboarding experience upon navigating to a screen deemed an appropriate starting place.
Automatic deactivation of dependent plugins
As currently implemented, plugins with unmet dependencies are automatically deactivated. While this was the approach suggested in initial discussions, there were valid concerns raised about this behavior after merging into trunk. These have been weighed and discussed, and a decision was made to remove this behavior.
Third-party plugins not hosted on WordPress.org
Defining plugins not hosted on WordPress.org as dependencies will enforce and display the dependencies to the user. However, there will be no ability to install the missing plugins through the UIUIUser interface changes, and these will need to be installed manually.
UI changes
The feature makes changes to the UI on two screens: Plugins > Installed plugins, and Plugins > Add New.
Dependent plugin rows now contain a list of their dependencies, linked to the respective plugin modal to install and activate the dependency.
Dependency plugin rows now contain a list of their dependents.
If a plugin has dependencies that are not installed and active, the Activate link is disabled.
If a plugin has dependents that are active, the Deactivate and Delete links are disabled.
Before
After
Plugins > Add New
The following changes are made:
If a plugin has unmet dependencies, the Install Now and Activate buttons are disabled, both in their plugin card and their plugin information modal.
Dependent plugin cards now contain a notice listing their dependencies, with a View Details link to the dependency’s information modal which contains Install Now or Activate buttons based on their current installation status.
Plugin information modals are now persistent after button clicks, and modal-based plugin installation and activation are now performed through AJAX directly within the modal.
Before
After
User Testing
The feature team released calls for testing in October 2022 and March 2023. Additional user testing was performed during design and technical feedback with reports on the ticket and in the #core-upgrade-installSlackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. channel up to the day of commit.
Outcomes
Based on responses to calls for testing, and design and technical feedback, the following UI changes were made:
Adminadmin(and super admin) notices for each unmet dependency were reduced to a single notice informing the user that there were plugins with unmet dependencies.
A dedicated Dependencies tab was removed from the Plugins > Add New screen in favour of an integrated solution in plugin rows on Plugins > Installed plugins and plugin cards on Plugins > Add New.
The plugin row on Plugins > Installed plugins had a Manage Dependencies action link removed, which linked to the removed Dependencies tab.
Messaging was improved to inform the user about missing dependencies.
Security
A security review was performed by @costdev during the development of the feature following WordPress security best practices of escaping output, sanitizing input (slugs, POST, etc.), verifying AJAX referrers and using nonces where appropriate. Comparisons were also done with existing functionality to avoid missed opportunity for hardening the feature.
AccessibilityAccessibilityAccessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both “direct access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility)
The feature was reviewed by the team for accessibility concerns. In addition, @costdev reached out to @joedolson regarding the use of links (<a>) as buttons, rather than <button> elements.
It was deemed that this approach, though likely not ideal, is consistent with the patterns throughout the code base today. A wider conversation is needed before a decision can be made about this specific accessibility pattern at a later date.
wp.a11y.speak() is implemented where appropriate in JavascriptJavaScriptJavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/., consistent with prior functionality in Core.
Unit Tests
In addition to user testing, testing by Core developers, and the feature team, unit tests have been written for the feature and the public API is covered. There are plans to continue increasing test coverage during the 6.5 BetaBetaA pre-release of software that is given out to a large group of users to trial under real conditions. Beta versions have gone through alpha testing in-house and are generally fairly close in look, feel and function to the final product; however, design changes often occur as part of the process. period.
These are the notes from the first post-WCUS chat we had on Thursday, September 13th, 2023 at 12:00 PM CDT in the #core-fields channel of Make WordPress Slack.
A few agenda items were proposed in the channel by @alexstandiford including the following items. (Marked to show what we ended up getting through so far)
☑ Broadly speaking, what is the scope for V1?
☐ Can we define the independent pieces of this project? If not, what do we need to know in order to understand those pieces?
☐ Is it realistic to expect that we could split this project into smaller pieces, lead by groups of the contributors?
☐ How do we approach presenting this to coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress.? How often to we provide updates?
☐ General discussion around the findings and conclusions surrounding the JSON fields API pitch. Could defining the JSONJSONJSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. help us understand the components that make the fields APIAPIAn 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.?
What we talked about in the chat
We ended up spending over an hour discussing only that first item: What we as contributors think that V1 should and should not include. Feedback was varied so I gathered the list of things people came up with and turned that into a survey that contributors could vote on.
Survey: What to include in a V1 proposal
We also invite everyone in the community to provide feedback on what you think the V1 proposal for Fields API should include.
The survey will close on Wednesday, September 20th, 2023 at 12:00 PM (UTC-5) and we will share the results in the planned Fields API chat that day.
Remaining areas to research
We still have a few more screens to add research documentation for and those are these:
Users
User registration form
Media – Media modal
CustomizerCustomizerTool 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 – @sc0ttkclark will take this on
Nav Menus (classic)
Name Menu form
Nav Menu Item form
If you’d like to help out, hop into #core-fields and or GitHub repository and let us know what area you’d like to contribute to.
Next scheduled chat
We will be meeting again in #core-fields on Wednesday, September 20th, 2023 at 12:00 PM (UTC-5)
The coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. performance team recently conducted an in-depth i18n performance analysis. It showed that localized WordPress sites load significantly slower than a site without translations. The blogblog(versus network, site) post presented and compared multiple solutions to this problem, and now the team would like to test the most promising approach at a wider scale using a dedicated pluginPluginA 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.
Introducing the Performant Translations plugin
What it does
The Performant Translations plugin uses a new approach to handle translationtranslationThe process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. files in WordPress, making localization blazing fast. The primary purpose of this plugin is to allow broader testing of these enhancements, for which the goal is to eventually land in WordPress core.
This plugin helps to make localized WordPress sites faster by replacing the traditional MO translation files with PHPPHPThe web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher files, which are much faster to parse. Plus, PHP files can be stored in the so-called OPcache, which provides an additional speed boost.
If your site is using a language other than English (US), you should see immediate speed improvements simply by activating this plugin. No further action is required.
The Performant Translations plugin is available for download on WordPress.orgWordPress.orgThe community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/ or directly from your WordPress adminadmin(and super admin).
Since the Performant Translations plugin requires no configuration, all that’s needed to benefit from its speed improvements is to activate the plugin.
To verify that something has changed, you could use a tool like Query Monitor or an external tool for testing server response times. In Query Monitor, the page load time and memory usage should drop quite a bit after plugin activation:
In Query Monitor you will also see how translations are loaded from PHP files from now on:
While the plugin is mostly considered to be a betaBetaA pre-release of software that is given out to a large group of users to trial under real conditions. Beta versions have gone through alpha testing in-house and are generally fairly close in look, feel and function to the final product; however, design changes often occur as part of the process. testing plugin, it has been tested and established to a degree where it should be okay to use in production. Still, as with every plugin, you are doing so at your own risk.
It’s also worth noting that the plugin has been successfully tested with common multilingual plugins, such as WPML, Weglot, TranslatePress, MultilingualPress, and Polylang. It also works fine with Loco Translate and the Preferred Languagesfeature pluginFeature PluginA plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See Features as Plugins..
Should you choose to stop testing the Performant Translation plugins, uninstalling it will remove all of its traces.
The performance team’s goal is to get as much feedback as possible and further refine the approach so that it can ultimately be proposed to be merged into WordPress core 6.5. That means testing will last for a few months at least.
We had a solid day of progress today at the WCUS Contributor DayContributor DayContributor Days are standalone days, frequently held before or after WordCamps but they can also happen at any time. They are events where people get together to work on various areas of https://make.wordpress.org/ There are many teams that people can participate in, each with a different focus. https://2017.us.wordcamp.org/contributor-day/https://make.wordpress.org/support/handbook/getting-started/getting-started-at-a-contributor-day/.. I sat down at an empty table and before long it was full of people who were eager to help bring the vision of the Fields APIAPIAn 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. to fruition.
If you aren’t familiar yet with what we’ve been planning, check out the post below about the kick-off we had at the start of this year. Otherwise, continue on below to see what we’ve accomplished and what’s left in the Research phase.
Add new user form (/networknetwork(versus site, blog)/ variation)
Add existing user to site form (MultisitemultisiteUsed to describe a WordPress installation with a network of multiple blogs, grouped by sites. This installation type has shared users tables, and creates separate database tables for each blog (wp_posts becomes wp_0_posts). See also network, blog, site)
Media – Media modal
Comments – Add new comment (front of site) – @cr0ybot
✅ BlockBlockBlock is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. Editor
CustomizerCustomizerTool 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
We also had help from @lauriewood who spent time writing a proposal draft for us that we can use to build from with more technical details.
Comparison sheet
I put together a comparison sheet that goes over coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. APIs vs a few popular plugins. It may help you visualize what we are doing here.
What’s next?
Our next meeting
We’re going to set up another meeting in #core-fields on SlackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. in September to get everyone together again. I’ll post here again as soon as we have a time set so others who are interested can join.
Research will continue
We have a few more docs to continue working on. We will coordinate who does what in the #core-fields Slack channel. If you’re interested in helping, feel free to mention me (@sc0ttkclark) there!
Proposing the Fields API
We will then be able to officially propose the Fields API based on our research and gather feedback on what we’ve put together. The proposed code will likely remain similar to what was proposed in 2017 but with more modern PHPPHPThe web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher 7+ code and potentially support for JSONJSONJSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. schema files if there’s appetite in core to expand beyond the Blocks JSON schema implementation and into other config areas.
Since the last update on the Preferred Languages feature plugin, a lot of work has been accomplished both on the pluginPluginA 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 side and in coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. to make the solution more robust in a variety of ways. Today, I want to provide a bit more details on these accomplishments, which resulted in the recent release of Preferred Languages 2.0, advancing the project a huge step closer towards a core merge proposal
But first, make sure to check out the previous update:
Over the last year, a lot of work has gone into making the plugin more stable by adding more tests and fixing bugs. This includes improving compatibility with other plugins and making translationtranslationThe process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. merging and localeLocaleA locale is a combination of language and regional dialect. Usually locales correspond to countries, as is the case with Portuguese (Portugal) and Portuguese (Brazil). Other examples of locales include Canadian English and U.S. English. switching more robust. As a result, pure unit testunit testCode written to test a small piece of code or functionality within a larger application. Everything from themes to WordPress core have a series of unit tests. Also see regression. code coverage is near 100%, with end-to-end tests adding another layer of confidence.
With WordPress adding several i18ni18nInternationalization, or the act of writing and preparing code to be fully translatable into other languages. Also see localization. Often written with a lowercase i so it is not confused with a lowercase L or the numeral 1. Often an acquired skill. improvements in WordPress 6.1 and 6.2, the Preferred Languages plugin is now fully compatible with WP_Textdomain_Registry and switch_to_user_locale(). The minimum required WordPress version has been bumped to 6.1 as a result.
Certainly the biggest change, however, was the full refactoring of the UIUIUser interface itself. The whole JavaScriptJavaScriptJavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. portion of the code base was over 6 years old and using jQuery and jQuery UI. But not anymore! The UI has been completely refactored to use ReactReactReact is a JavaScript library that makes it easy to reason about, construct, and maintain stateless and stateful user interfaces. https://reactjs.org/., with the same components that also power the blockBlockBlock is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. editor. In the process, drag & drop sorting functionality was removed to simplify the UI, and accessibilityAccessibilityAccessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both “direct access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility) has improved, but otherwise everything looks mostly the same.
How to help
So, what’s next? The latest version of the Preferred Languages feature pluginFeature PluginA plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See Features as Plugins. needs more eyes testing it and providing feedback.
One big remaining question mark is the concept of translation merging. By default, if there are only some missing strings in a selected locale, these would be displayed in English. But with translation merging, the missing strings will be taken from the locale next in line instead. While this works great, it could be a tad slow due to the way translations are loaded in WordPress. Any help addressing this potential performance concern would be greatly appreciated.
Note: The merging feature can be enabled with add_filter( 'preferred_languages_merge_translations', '__return_true' );.
Active development is taking place on GitHub. If you want to get involved, check out the open issues and join the #core-i18n channel on Slack.
We are seeking basic workflow feedback for the Plugin Dependencies feature. Testing should be very straightforward.
The testing pluginPluginA 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 was chosen because it fulfilled the following criteria:
Plugin is in the plugin repository.
Plugin has the required Requires PluginsheaderHeaderThe header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. for Plugin Dependencies.
Install and activate The Events Calendar CategoryCategoryThe 'category' taxonomy lets you group posts / content together that share a common bond. Categories are pre-defined and broad ranging. Colors plugin.
The goal is to see how intuitive the process is or might become.
Feedback
What did you do?
Did you get stuck? Where?
Were you able to figure out the path forward?
What did you do?
Did the experience feel “natural” to WordPress?
Thanks for testing. Testing should last for 3 weeks.
It’s been over 4 years since the Fields API project has been active and many things have changed for WordPress in that period.
Since then, many things were introduced into WordPress itself including things like:
BlockBlockBlock is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. Editor
Full Site Editing has replaced the CustomizerCustomizerTool 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. (which is now only used for classic themes)
New Navigation editing
Widgets are now legacy and have been replaced with new blocks and a new WidgetWidgetA 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. editor
Newer PHPPHPThe web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher compatibility (testing still in progress for PHP 8.0+) and talks of upping the minimum PHP version
All of that has led to @joedolson approaching me to determine if it’s worth bringing Fields APIAPIAn 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. back with a new vision.
After some initial discussion, the passion reignited within me to get this going again and we ended up having our first kick-off meeting today to discuss where we’ve been, where we’re at, and where we want to go in 2023. This and future work will be organized through our SlackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. channel #core-fields
Read below for what we discussed and here’s a link to watch the video from our initial meeting.
WP CoreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress.CommittercommitterA developer with commit access. WordPress has five lead developers and four permanent core developers with commit access. Additionally, the project usually has a few guest or component committers - a developer receiving commit access, generally for a single release cycle (sometimes renewed) and/or for a specific component.
Working on the AccessibilityAccessibilityAccessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both “direct access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility) team
Reached out to Scott about Fields API from the perspective of improving accessibility for the Settings page
Started holding meetings back when Freenode IRCIRCInternet 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. was being used before Slack
Initial focus was around Post metaMetaMeta 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. fields and meta boxes in the Post Editor
Expanded over time to cover a generalized API to work with
Post meta boxes and their fields
Settings fields (replacing the Settings API)
User profile fields (edit profile, add new user)
Term fields (add term, edit term)
Comment fields (add comment on frontend, edit comment in dashboard)
Media fields (modal)
Customizer (allowing the Customizer to see Fields API configurations)
We built 3 different prototypes over time
Hundred of plugins in WP have their own Fields API and lots of devs have their own preference on code structure so there were lots of voices with different opinions for what the Fields API should look like
WP Core team (committers and contributors) were somewhat receptive but we couldn’t gain momentum
The block editor and other projects started up which reduced priority for getting Fields API into WP especially since it wasn’t just one small part of WP
@sc0ttkclark reached out for anyone else to take over the project as lead (while Scott supported) but couldn’t find anyone so the project became inactive
Rebooting Fields API – where we’re at
@joedolson approached @courane01 and @sc0ttkclark to see if we wanted to tackle Accessibility as a goal for a smaller reboot of the Fields API
The GitHub repository has been unarchived and is ready to start the next steps of getting things going again
Lots of test coverage for the API itself
A number of examples of how to work with the API
Implementations that were covered at the time (in WP 4.5)
PHP 5.6 is the current minimum and we’ll stick to that unless progress is made on upping the minimum WP version
If the minimum version is upped, we can revisit this and adjust our code to follow suit
@borkweb How we approach things in WP now is much different than back when the Fields API started
Is there merit in separation of data and output like what GiveWP is doing versus what the very coupled approach that the Fields API has right now
@joedolson Whether this can be potentially be used for the Block Editor may have a big impact on whether it has traction, though there are plenty places where it could be useful
Content areas like Posts and Terms, we’ll likely see more expansion of the Block Editor
There are a few places in WP that may not make sense to be in the block editor itself
Settings
User profile
Maybe others?
Those areas may eventually use ReactReactReact is a JavaScript library that makes it easy to reason about, construct, and maintain stateless and stateful user interfaces. https://reactjs.org/. components to render but won’t live in the “Block Editor” that we know of today
We could separate the Fields API focus into specific component implementations, not unlike what we had before but with the goal being that we are registering structure – whether or not that is the same exact input used for each screen (some screens will need their own form implementations for their inputs that may not be HTMLHTMLHyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. renders)
If we wanted to implement Fields API for the Block Editor, it could help register Components for the Inspector Panel for Blocks, which is currently an area with high copy/paste
Fields API could register Inspector Panel sections and components
PHP has grown up and it may be better to use objects than straight PHP arrays especially since that can work with IDEs and help with autocomplete for a better developer experience
With the Fields API, I want to make possible the idea that you can interact with the configuration of a form and add/change fields by registering new fields or adjusting their configurations
Knowing what the structure of a page is (outside of just basic actions that people use now to render HTML) gives devs the ability to take those configurations and consume them through WP-CLIWP-CLIWP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/https://make.wordpress.org/cli/, the REST APIREST APIThe 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 PHP for custom implementations like the WordPress iOSiOSThe operating system used on iPhones and iPads. app and many other apps that need to represent the various edit screens
@borkweb So the Fields API project would morph into a data layer and one or more rendering implementations to consume that
We can focus on Settings page at first and go from there into the User profile, but leave everything else out until we gain traction and get something into Core
Don’t focus on legacy things like the Classic Editor or Customizer or the Widget forms
@joedolson Getting this built out and implemented is a challenge but I’m game
@sc0ttkclark We should figure out what we want to structure the Fields API off of, but use object oriented as much as possible and make the focus on better developer experience so we can help level up working with WP
We could look at the structure of GiveWP’s Fields API and other modern Fields APIs from other plugins/libraries
Avoid looking back at older/legacy plugins and libraries
Find a consensus on what makes sense that most people will be familiar with based on what’s popular/modern
The current Fields API is based on the Customizer API which has become antiquated already
Next steps
Meetings: Figure out the frequency of meetings and when our next meeting is
Viability: Get a gut-check from WP core dev team in the core meeting and through responses to this post on direction and our focus
Spec: Look at modern Fields APIs in modern plugins/libraries and figure out how we want that structure to look like through a new spec doc
Code: Start with a Settings API implementation collaborating with @joedolson and the Accessibility team to ensure that side is accessible
Testing: Ensure the API is well tested with unit tests
This feature allows pluginPluginA 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 to identify which other plugins must be installed so that their plugin functions as expected. This is done by adding a “Requires Plugins” headerHeaderThe header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. to the docblockdocblock(phpdoc, xref, inline docs) of the main plugin file which contains a comma-separated list of slugs for the required plugins.
The feature is not intended to work with Must-Use plugins, nor does it impact them.
Delete the Hello Dolly plugin, a single file plugin cannot be a dependency
Copy the three test plugin files from /plugins/wp-plugin-dependencies/test-plugins to the /plugins directory.
Navigate to Plugins > Installed Plugins.
Test Instructions / Key Features
Confirm that a new adminadmin(and super admin) notice is displayed if there are additional plugins that must be installed if dependencies are missing.
Confirm that individual plugins with dependency relationships on Plugins > Installed Plugins display Requires or Required by: under the version information.
Add (install/activate) needed dependencies.
Confirm that admin notice goes away once all the dependencies have been installed. Dependencies don’t need to be activated for the admin notice to be satisfied and go away.
After installing all dependencies, confirm that the new admin notice disappears.
Confirm that the Deactivate link and checkbox are not available for plugins that are dependencies with active dependent plugins.
Once all dependent plugins are deactivated, confirm that plugin dependencies can then be deactivated and deleted.
Confirm that the Add Plugins > Dependencies page lists correct plugins, including non-WordPress.orgWordPress.orgThe community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/ plugins that are and aren’t supported.
Other Things to Test
In a test plugin, try to add a dependency using a plugin’s full name (not slug).
No dependency should be noted
Add a dependency for a non-wordpress.org plugin slug that is installed/active.
Hook the Plugins APIAPIAn 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. to register a non-wordpress.org plugin.
This is done with the GitGitGit is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. Most modern plugin and theme development is being done with this version control system. https://git-scm.com/. Updater plugin
Test adding “Requires Plugins” to the DocBlock of a plugin in mu-plugins.
Nothing should happen as mu-plugins are not supported for this feature.
What’s New?
In the main plugin file’s docblock:
A Requires Plugins header has been introduced.
List the slugs of the dependencies in a comma separated string. For example:
An admin notice informs site owners if there are additional plugins that must be installed. It will display as long as there are uninstalled dependencies.
Each plugin that requires other plugins has a new line in the plugin description. For example:
Each plugin that is a dependency, and is also dependent on other plugins, has both lines above.
If all the dependencies of a plugin have not been installed and activated then the dependent plugin will not be able to be activated.
Plugins page
On the Plugins > Add New > Dependencies tab:
The above Requires and Required by data will display in the plugin card.
This tab shows a card for each plugin that is required for other plugins to work.
Familiar Install Now, Activate and Active buttons are provided so that site owners can manage these plugins.
If a dependency is not available on wordpress.org and does not integrate with the Plugin Dependencies feature, it will not be possible to install or activate via this tab. The plugin will display in a generic card.
It is possible to integrate a dependency that is not available on wordpress.org with the Plugin Dependencies feature. This requires hooking into the plugins_api_requestfilterFilterFilters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. and returning a valid plugins_api() response. This type of code was added to the feature pluginFeature PluginA plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See Features as Plugins. as a composer dependency with afragen/add-plugin-dependency-api, and a filter to the endpoint returning valid plugins_api() response for the Git Updater plugin.
Plugin > Add New page
Instructions for Reporting Issues
Please leave feedback in the comments below this post.
You must be logged in to post a comment.