Make WordPress Core

Keyboard Shortcuts | Hide comment threads

WordPress 5.4 Field Guide

WordPress 5.4 is shaping up to be the best WordPress 2020 has seen!

As a user, you’ll see new blocks and enhancements in the block editor, new embeds, and improvements in the WordPress Admin experience.

As a developer, you’ll see 122 enhancements and feature requests, 210 bug fixes, and more! Of course, all those improvements mean code changes, which could in turn require you to make updates to your site, plugin, or theme.

So take a look through this Field Guide, and see what’s relevant to you and your users, among the many improvements coming in 5.4…

Accessibility

On the 14 updates related to Accessibility in 5.4, you’ll want to particularly note changes to the WordPress Admin Bar, to the calendar and recent comments widgets, on the Menu screen, and bugs reported by the WPCampus accessibility report.

Block Editor

The block editor has continued its rapid iteration since WordPress 5.0. Now it has Gutenberg version 7.5 bundled with WordPress 5.4; that’s ten releases all bundled into WordPress 5.4 (versions 6.66.76.86.97.07.17.27.37.4  and 7.5)! Bug fixes and performance improvements from Gutenberg versions 7.6 will also be part of 5.4.

The WordPress 5.4 Beta 1 post highlights a lot of new features and improvements across these releases, though you’ll also want to note the impressive achievement of 14% loading-time reduction and 51% time-to-type reduction (for a particularly long post of ~36,000 words, ~1,000 blocks) since WordPress 5.3.

Below you’ll find details on two new blocks, button component updates, block collections, default fullscreen mode for new installs/devices, custom keyboard shortcuts, general block editor API updates, new block variations API, a new gradient theme API, markup and style-related changes, and a new @wordpress/create-block package for block scaffolding.

Customizer

On the 14 updates of the Customizer component, WordPress 5.4 improves accessibility of focused elements as a follow-up to WordPress 5.3 Admin CSS changes, adds documentation of existing Customizer functions and hooks, removes apple-touch-icon-precomposed deprecated meta tags, and improves Menu items selection logic.

Please note that some unused Customizer classes are now formally deprecated:

Menus

On the 5 updates in the Menus component, WordPress 5.4 improves keyboard accessibility of the Menu items selection tab panel and streamlines the user interface.

If your plugins add custom fields to menu items, you’ll want to update your code to use the new wp_nav_menu_item_custom_fields hook:

Privacy

On the 15 updates in the Privacy component, you will want to specifically note:

  • Personal Data Export now includes Session Tokens, Community Events Location and Custom User Meta.
  • Personal Data Exports now include a JSON file and a Table of Contents
  • New filters for the headers of all Privacy-related emails
  • The privacy tables are improved for a cleaner interface
  • wp_get_user_request_data() function was replaced with wp_get_user_request() for better clarity

All those changes are in this dev note:

REST API

On the 22 updates related to the REST API, WordPress 5.4 now supports “OR” taxonomy relation parameter in Post Controller, adds selective link embedding and introduces some changes in the WP_REST_Server method. Read below for more details on these updates:

Shortcodes

On the 3 updates to the Shortcodes component, WordPress 5.4 introduces documentation improvements and a new function: apply_shortcodes. This function is an alias of do_shortcode, which is still supported.

Widgets

On the 9 updates to the Widgets component, WordPress 5.4 introduces accessibility and user interface enhancements on the Widgets Admin screen and changes in the Recent Comments and Calendar Widgets HTML markup.

Other Developer Updates

There are even more goodies in 5.4, like the new wp-env (a zero config tool for painless local WordPress environments), enhancements to favicon handling, better information about errors in wp_login_failed, a new site ID in multisite’s newblog_notify_siteadmin filter, a new TikTok video embed and removal of the CollegeHumor embed, storing the original URL of media attachments in _source_url post meta, improved accessibility by loading the Admin Bar with wp_body_open, avoiding duplicate IDs in the Recent Comments widget, a new parameter in the lostpassword_post action in retrieve_password(), theme headers supporting “Requires at least” and “Requires PHP” declarations, and the delete_posts capability won’t trigger PHP notices for custom post types. Read through the dev notes below to see details on all these changes coming in 5.4.

But Wait, There is More!

Over 198 bugs, 121 enhancements and feature requests, and 8 blessed tasks have been marked as fixed in WordPress 5.4. Some additional ones to highlight include:

  • Bootstrap/Load: Enhancement to favicon handling (#47398)
  • Bundled Theme: Twenty Twenty: Add social icon for WhatsApp (#49098)
  • Comments: Add “In response to …” before threaded comments in comment feed (#43429)
  • Comments: Add “in reply to” in comment moderation email notification (#43805)
  • Embeds: Embed support has been added for TikTok (#49083) (Gutenberg#19345)
  • Embeds: Removal of CollegeHumor embed as the service doesn’t exists anymore (#48696) (Gutenberg#18591)
  • Login and Registration: Clearer information about errors in wp_login_failed (#49007)
  • Login and Registration: new parameter passed into the lostpassword_post action in retrieve_password() (#38334)
  • Networks and Sites: Site ID has been added to the newblog_notify_siteadmin filter for multisite installs (#48554)
  • Networks and Sites: switch_to_blog() and restore_current_blog() reuse switch_blog action (#49265)
  • Media: store the original URL of the attachment in the _source_url post meta value (#48164)
  • Menus: Make tabs panels more accessible for keyboard users (#49211)
  • Posts, Post Types: Use delete_posts without triggering PHP notices in every post type (#30991)
  • Post Thumbnails: Make sure get_post_thumbnail_id() returns an integer, to match the documented return value (#40096)
  • REST API: Expose all theme supports and changed permissions in /themes endpoint (#49037)
  • Site Health: Theme headers support “Requires at least” and “Requires PHP” declarations (#44592)
  • Toolbar: The Admin Bar is now loaded with wp_body_open when available (#47053)
  • Widgets: Avoid duplicate IDs in Recent Comments (#46747)

Please, test your code. Fixing issues helps you and helps millions of WordPress sites.

Props to @jeffpaul and @marybaum for contributing to this guide.

#5-4, #field-guide

Bug Scrub Schedule for 5.4

Now that 5.4 has been officially kicked off, bug scrubs will happen weekly all the way up to the final release. Keep an eye on this schedule – it will change often to reflect the latest information.

  1. Tuesday, January 21, 2020 at 07:00 PM UTC
  2. Wednesday, January 29, 2020 at 11:00 PM UTC
  3. Friday, February 7, 2020 at 05:00 AM UTC (APAC-Friendly)
  4. Monday, February 10, 2020 at 04:00 PM UTC
  5. Tuesday, February 18, 2020 at 08:00 PM UTC
  6. Thursday, February 27, 2020 at 11:00 PM UTC
  7. Monday, March 2, 2020 at 06:00 PM UTC
  8. 3/11/2020 TBD (If Necessary)
  9. 3/17/2020 TBD (If Necessary)
  10. 3/27/2020 TBD (If Necessary)
  11. 3/30/2020 TBD (If Necessary)

These scrubs are separate and in addition to the normal scrubbing and triage by individual components. Some of those sessions include:

Design Triage: Every Monday 17:30 UTC at #design
Gutenberg Design Triage: Every Tuesday 17:00 UTC at #design
Accessibility Scrub: Every Friday 14:00 UTC at #accessibility

Also, the ongoing APAC-friendly #core bug scrub session every Thursday at 06:00 UTC will continue during the cycle, alternating focus between core and editor.

Next, the Accessibility team has announced a few extra scrubs for the 5.4 cycle. You can read about those here.

Finally, a reminder that anyone — Yes, you! — can host a bug scrub at anytime. You can work through any tickets you’re comfortable with. In fact, if you plan one that’s 5.4-focused, we’ll add it to the schedule here along with your name. Finally, you’ll get well deserved props in the weekly Dev Chat, as well as in the #props Slack channel!

All open tickets for 5.4, in order of priority, can be found here. Tickets that haven’t seen any love in a while are in particular need. Those can be found in this query.

If you’d like to lead a bug scrub or have any questions or concerns about the schedule, please leave a comment or reach out to me directly.

#5-4, #bug-scrub

Dev chat summary, March 18, 2020

@marybaum facilitated the chat on this agenda.

Full meeting transcript on Slack

This devchat marked week 10 of the 5.4 release cycle.

Announcements

WordPress 5.4 Release Candidate 3 was released on Tuesday March 17th! 🎉Thank you to everyone that has contributed! @johannlinnarsson asked when we might expect the final 5.4 release and @marybaum confirmed that March 31 is the target release date. 

Upcoming releases WordPress 5.4

WordPress 5.4 About Page: @karmatosed shared that many many folks contributed to the design and creation of the About page. Thank you to everyone that contributed. Testing is very much appreciated at this point as we prepare for release candidate 4 on March 24.

@jorgefilipecosta mentioned that there are two pull requests that are in need of review for 5.4 and those can be found at this link.

 @clorith asked if there was any additional information regarding the recent changes to editor default views and there is currently no new information outside of the discussions in the blog post. 

Components Check-In

@azaozz had some exciting Media updates showing off the now merged 1.1 changes for the Lazy Loading Feature Plugin and said that he will be working on a patch to introduce in trunk (5.5.) More to come soon on this much anticipated feature! If you’d like to contribute here is a link to the GitHub repo.

@audrasjb introduced some new changes to WP Auto Updates saying, “WP Auto-updates Feature Plugin version 0.3.0 was released with email notifications for plugins automatic updates. Next version will be focused on porting all the current features to themes screen.” A summary of this chat can be found at this link. If you would like to get involved in contributing to this feature, please feel free to jump into the Feature Plugin GitHub repo.

@pbiron mentioned another plugin that could benefit from some testing; Core Sitemaps plugin is aiming for an early inclusion into 5.5. Please feel encouraged to test it ahead of time! If you’d like to contribute to this feature, explore the GitHub repo!

@aduth provided a #core-js update around their processes. He said, “In the #core-js chat this week, it was suggested to share that our weekly meeting summaries are now including a “News Roundup” of JavaScript and Gutenberg-related items, for those who might be interested or think it helpful to keep in the loop. “ A link to that can be found at the end of this summary post.

Props to @garrett-eclipse for the peer review of this summary. 🙏🏼

#5-4, #core, #feature-plugins

Updating the Coding standards for modern PHP

Until May last year, contributions to WordPress Core were bound to PHP 5.2 syntax and most plugins and themes stuck to the PHP 5.2 minimum requirement as well.

However, with the change to PHP 5.6 as the minimum PHP version for WordPress Core, new PHP features have become available for use in WP Core and with the outlook of a minimum version of PHP 7.x in the (near) future, even more interesting language features will soon become available for use in WordPress Core, plugins and themes.

With that in mind, we’d like to define coding standards for a number of these constructs and propose to implement automated checking for these in the WordPress Coding Standards tooling in the near future.

While it may still be a while before some of these features will actually be adopted for use in WordPress Core, defining the coding standards in advance will allow for a consistent code base when they do get adopted and will allow for plugins and themes, which are not necessarily bound to the PHP 5.6 minimum, to safeguard their code consistency when they start using more modern PHP already.

To be honest, none of these proposals are terribly exciting and some may not even seem worth mentioning. Most follow either prior art in WordPress Core or industry standards for the same, but in the spirit of openness, we’d like to verify our take on these before implementing them.

Show full post

So without further ado, the following coding standards are proposed for implementation in the WordPress Coding Standards 3.0.0:

Rules for modern PHP constructs

Namespace declarations

Proposed standards:

  1. The namespace keyword should be lowercase.
  2. There should be exactly one space between the namespace keyword and the start of the namespace name in a namespace declaration.
    And to be extra clear: namespace names in a namespace declaration should not start with a leading backslash \. This would be a parse error in most cases anyway.
  3. Each “leaf” of a namespace name should be in Camel_Caps, i.e. each word should start with a capital and words should be separated by an underscore.
    Consecutive caps, like for acronyms, will be allowed. This is in line with other WP naming conventions.
  4. There should be no whitespace or comments within the name part of the namespace declaration.
  5. There should be exactly one blank line before a namespace declaration.
  6. There should be at least one blank line after a namespace declaration.
  7. There should be only one namespace declaration per file.
    This automatically implies that the namespace declaration should be at the top of a file, with only the file docblock and an optional declare statement preceding it.
  8. Namespace declaration using the curly brace block syntax are not allowed.
  9. Namespace declarations without name (= explicit global namespace) are not allowed.

Related open WPCS issue: http://wayback.fauppsala.se:80/wayback/20200321162927/https://github.com/WordPress/WordPress-Coding-Standards/issues/1763

Valid code example

1
2
3
4
5
6
7
8
<?php
/**
 * File docblock.
 */
 
namespace Prefix\Admin\Domain_URL\Sub_Domain\Event;
 
use ...

Invalid code examples

1
2
3
4
5
6
7
<?php
/**
 * File docblock.
 */
namespace Prefix \
    /* Here comes the real namespace */ Admin\DomainURL\ SubDomain\Event;
use ...
1
2
3
4
5
6
7
8
9
10
11
<?php
/**
 * File docblock.
 */
namespace Foo {
    // Code.
}
 
namespace {
    // Code.
}

Usage in WordPress Core

As previously stated, the introduction of namespaces into WordPress Core will need to be a concerted effort with careful thought about the implications for the architecture as a whole.
There is currently no timeline for introducing namespaces to WordPress Core.

Usage in plugins and themes

The use of namespaces in plugins and themes is strongly encouraged. It is a great way to prefix a lot of your code to prevent naming conflicts with other plugins, themes and/or WordPress Core.

Please do make sure you use a unique and long enough namespace prefix to actually prevent conflicts. Generally speaking, using a namespace prefix along the lines of Vendor\Packagename is a good idea.

And while not new, this may also be a good time to remind you that using wp or WordPress as a prefix is not allowed (regardless of case).

1
2
3
4
5
// Correct.
namespace My_Awesome_Plugin\Admin;
 
// Incorrect.
namespace MAP\Admin;

Also be aware that namespacing has no effect on variables declared outside of functions/classes, constants declared with define() or non-PHP native constructs, like the hook names as used in WordPress.
Those still need to be prefixed individually.

Import use statements

Proposed standards:

  1. Import use statements should be at the top of a file and should directly follow the (optional) namespace declaration.
  2. Import use statements should be ordered by type: first import use statements for classes, interfaces and traits, next import use statements for functions and lastly import use statements for constants.
    No rules are currently set for the ordering of import use statements of the same type. This will be revisited at a later point in time.
  3. There should be exactly one blank line before the first import use statement of each type and at least one blank line after the last import use statement.
  4. The use, function, const and as keywords should be lowercase.
  5. There should be exactly one space after each keyword.
  6. Names in an import use statement should not start with a leading backslash \.
    All names in import use statements must be fully qualified by nature, so a \ at the start is redundant.
  7. There should be no whitespace or comments within the name part of a use declaration.
  8. Alias names should comply with the existing WordPress naming conventions for class/function/constant names.
  9. Only set an alias when using a different name.
    I.e. this is not allowed: use My\Project\ClassName as ClassName.
    Note: as these names are case-insensitive in PHP, aliasing to the same name in a different case falls under this rule and is forbidden.
  10. When using group use statements:
    1. There should be one statement for each type – OO constructs (classes/interfaces/traits), functions, constants. The various types should not be combined in one group use statement.
    2. There should be no space between the namespace separator and the opening curly brace for the group use.
    3. The opening curly brace should be the last code element of the line.
    4. Each sub-statement must be one a line by itself and should be indented one tab in from the use statement keyword.
    5. When possible (PHP 7.2+), the last statement should be followed by a trailing comma.
      This will not be enforced until the minimum PHP requirement has been raised to PHP 7.2.
    6. The closing curly brace should be on a line by itself with no blank line(s) before it.
    7. The closing curly brace must be indented the same as the use keyword.

At this time, no standards are defined (yet) on when an import use statement should be used and when to use a fully qualified name inline. Guidelines to that effect may be added at a later point in time.

Valid code example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
 * File doc block.
 */
 
namespace WordPress\subnamespace;
 
use Some\Namespace\Class_A;
use Some\Namespace\Class_C as Aliased_Class_C;
use Some\Namespace\{
    Class_D,
    Class_E as Aliased_Class_E,
}
 
use function Some\Namespace\function_a;
use function Some\Namespace\function_b as aliased_function;
 
use const Some\Namespace\CONSTANT_A;
use const Some\Namespace\CONSTANT_D as ALIASED_CONSTANT;
 
// Rest of the code

Invalid code example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
/**
 * File doc block.
 */
 
namespace WordPress\subnamespace;
 
use Some\Namespace \ /*comment*/ Class_A;
use   const   Some\Namespace\CONSTANT_A;
use function Some\Namespace\function_a;
use \Some\Namespace\Class_C as aliased_class_c;
use Some\Namespace\{Class_D, Class_E   as   Aliased_Class_E}
use Vendor\Package\{ function function_a, function function_b,
     Class_C,
        const CONSTANT_NAME};
 
class Foo {
    // Code.
}
 
use const \Some\Namespace\CONSTANT_D as Aliased_constant;
use function Some\Namespace\function_b as Aliased_Function;
 
// Rest of the code

Usage in WordPress Core

While import use statements can already be used in WordPress Core, it is, for the moment, strongly discouraged.

Import use statements are most useful when combined with namespaces and a class autoloading implementation. As neither of these are currently in place for WordPress Core and discussions about this are ongoing, holding off on adding import use statements to WordPress Core is the sane choice for now.

Important notes:

  • Adding a use statement does not automatically load whatever is being imported. You still need to load the file containing the class/function/constant with a require/include statement before the imported code is used.
  • Import use statements have no effect on dynamic class, function or constant names.
  • Group use statements can not be used in WordPress Core until the minimum PHP version has been raised to PHP 7.0.
  • Trailing commas in group use statements can not be used in WordPress Core until the minimum PHP version has been raised to PHP 7.2.

Fully qualified names in inline code

Proposed standards:

  1. When using a fully or partially qualified name, no whitespace or comments are allowed within the name.

Code example

1
2
3
4
5
6
7
8
9
10
11
// Correct.
$foo = new \Vendor\Domain\Foo();
 
$result = namespace\function_name();
 
// Incorrect.
$foo = new \Vendor // Source: external dependency.
           \Domain
           \Foo();
 
$result = namespace \function_name();

Usage in WordPress Core

Until the introduction of namespaces, there is no need to introduce the use of fully qualified names in inline code into WordPress Core.

Traits and interfaces

Proposed standards for trait/interface declarations:

  1. Trait and interface names should use capitalized words separated by underscores, same as class names. Any acronyms should be all upper case.
    The word “Trait” is not required in a trait name, but won’t be forbidden either.
    The word “Interface” is not required in an interface name, but won’t be forbidden either.
  2. Trait file names should be based on the trait name with trait- prepended and the underscores in the trait name replaced with hyphens.
    The same goes for interface file names where the name should be based on the interface name with interface- prepended and the underscores in the interface name replaced with hyphens.
    Example: for a trait called Form_Field_Generator, the file should be named trait-form-field-generator.php.

For everything else, the same formatting rules as already in place for class declarations apply.

Proposed standards for the formatting of trait use statements:

  1. Trait use statements should be at the top of a class.
  2. Trait use statements should have exactly one blank line before the first use statement and at least one blank line after, with the exception of a class only containing a trait use statement in which case the blank line after may be omitted.
    Comments/docblocks directly above a trait use statement will be regarded as belonging with the statement and the blank line will be enforced above it.
  3. The use, insteadof and as keywords must be in lowercase.
  4. There must be exactly one space between the use keyword and the name of the trait.
  5. When grouping multiple traits in one use statement, there should be no space between a trait name and the comma and exactly one space between the comma and the next trait name.
  6. When using the insteadof or as statements:
    1. There must be exactly one space before and after each of these keywords.
    2. For single-line use statements, there must be exactly one space between the last trait name and the opening curly brace and exactly one space between the opening curly brace and start of the enclosed statement.
      There must also be exactly one space between the semi-colon at the end of the enclosed statement and the closing curly brace and the closing curly brace should be the last code element on the line.
    3. For multi-line use statements, there must be exactly one space between the last trait name and the opening curly brace and a new line after the opening curly brace.
      The closing curly brace should be on a line by itself with no blank line(s) before it.
      The closing brace must be indented the same as the use keyword.
    4. When using multiple insteadof or as statements grouped within curly braces, the statement must become a multi-line use statement and each of the insteadof or as statements must be on a line by itself, indented exactly one tab from the use keyword.

Code example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Correct.
class Foo {
 
    // Comments above a use statement will be regarded as documentation for the statement.
    use BarTrait;
    use FooTrait, BazingaTrait {
        BarTrait::method_name insteadof FooTrait;
        BazingaTrait::method_name as bazinga_method;
    }
    use LoopyTrait { eat as protected; }
 
    public $baz = true;
 
    ...
}
 
class Foo {
 
    use BarTrait;
}
 
// Incorrect.
class Foo {
    use       BarTrait;
 
 
    use FooTrait,   BazingaTrait{BarTrait::method_name    insteadof     FooTrait; BazingaTrait::method_name
        as     bazinga_method;
            };
    public $baz = true;
 
    ...
}

Usage in WordPress Core

Interfaces could already previously be used in WordPress Core and are encouraged to be used to clarify the public interface of sets of related classes.

Traits may be used in WordPress Core, though it should be carefully evaluated in each individual instance whether using a trait is the right decision from an architectural point of view.

Type declarations

Proposed standards:

  1. Type declarations must have exactly one space before and after the type.
    In case of a multi-line function declaration, a new line + appropriate indentation should be used before the type declaration.
  2. The nullability operator is regarded as part of the type declaration and there should be no space between this operator and the actual type.
  3. Keyword-based type declarations should use lowercase.
  4. Class/interface name based type declarations should use the case of the class/interface name as declared.

And specifically for return type declarations:

  1. There should be no space between the closing parenthesis of the function declaration and the colon starting a return type.

These rules apply to all structures allowing for type declarations: functions, closures, catch conditions as well as the PHP 7.4 arrow functions and typed properties.

Code example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Correct.
function foo( Class_Name $param_a, ?string $param_b, callable $param_c ): ?\Class_Name {
    // Do something.
}
 
function bar(
    Interface_Name $param_a,
    ?int $param_b,
    bool $param_c
): ?\Class_Name {
    // Do something.
}
 
// Incorrect.
function baz(Class_Name $param_a, ? Float$param_b,      CALLABLE     $param_c )  :   ?  \Class_Name{
    // Do something.
}

Usage in WordPress Core

While rare, array and class/interface name based type declarations already exist in WordPress Core.

Adding type declarations to existing WordPress Core functions should be done with extreme care.
The function signature of any function (method) which can be overloaded by plugins or themes should not be touched.
This includes all existing public and protected class methods and any conditionally declared (pluggable) functions in the global namespace.

This leaves, for now, only unconditionally declared functions in the global namespace, private class methods and code newly being introduced as candidates for adding type declarations.

For those, adding callable, class and interface name based parameter type declarations where the parameter type only expects one type and it would allow for simplification of existing/new code is allowed and tentatively encouraged.

Using the array keyword in type declarations is strongly discouraged for now, as most often, it would be better to use iterable to allow for more flexibility in the implementation and that keyword is not yet available for use in WordPress Core until the minimum requirements are upped to PHP 7.1.

Note:

  • The scalar bool, int, float and string type declarations can not be used in WordPress Core until the minimum PHP version has been raised to PHP 7.0.
  • Return type declarations can not be used until the minimum PHP version has been raised to PHP 7.0.
  • Nullable type declarations can not be used until the minimum PHP version has been raised to PHP 7.1.
  • The iterable, void and object type declarations can not be used until the minimum PHP version has been raised to PHP 7.1 and 7.2 respectively.
  • Property type declarations can not be used until the minimum PHP version has been raised to PHP 7.4.

Declare statements / strict typing

Proposed standards:

  1. There should be exactly one blank line above the declare statement and at least one blank line below.
  2. The keywords used – declare, strict_types, ticks and encoding – should be lowercase.
  3. There should be no space between the declare keyword and the open parenthesis.
  4. There should be no space on the inside of the parentheses.
  5. There should be no space on either side of the = operator used within declare statements.
  6. declare statements using the curly brace block syntax are allowed for ticks only. For declare statements using the curly brace block syntax:
    1. There should be exactly one space between the closing parenthesis and the opening curly brace and the opening curly should be the last code element on the line.
    2. The block contents should be indented one tab in from the indentation of the declare keyword.
    3. And the closing curly brace should be on a line by itself with no blank line above it and at least one blank line below it.

Note: these standards are different from those used for function calls. Keep in mind that declare is not a function.

Code example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Correct.
<?php
/**
 * File doc block.
 */
 
declare(strict_types=1);
 
use ...
 
declare(ticks=1) {
    // Do something.
}
 
// Incorrect.
<?php
/**
 * File doc block.
 */
declare ( strict_types = 1 );
use ...

Usage in WordPress Core

Strict typing should not be used in WordPress Core at this time.

It is a PHP 7.0+ feature, but even when WordPress Core would get a PHP 7.0 minimum requirement, implementing strict typing will need careful consideration as a lot of WordPress Core relies on the loose type nature of PHP, so this is not something to be undertaken lightly and is not on the agenda for the foreseeable future.

The other declare statements, ticks and encoding, can be used in WordPress Core when appropriate.

The ::class constant

Proposed standards:

  1. There should be no space between ::class and the preceding class name it applies to.
  2. There should be no space between the double colon and the class keyword.
  3. The class keyword should be in lowercase.

Code example

1
2
3
4
5
// Correct.
add_action( 'action_name', array( My_Class::class, 'method_name' ) );
 
// Incorrect.
add_action( 'action_name', array( My_Class :: CLASS, 'method_name' ) );

Usage in WordPress Core

The ::class constant can be freely used in WordPress Core.
Replacing existing uses of __CLASS__ with self::class and get_called_class() with static::class, where appropriate, is encouraged.

Operators

Spread operator ...

Proposed standards:

  1. There should be one space, or a new line + appropriate indentation, before the spread operator.
  2. There should be no space between the spread operator and the variable/function call it applies to.
  3. When combining the spread operator with the reference operator, there should be no space between them.

Related open WPCS issue: http://wayback.fauppsala.se:80/wayback/20200321162927/https://github.com/WordPress/WordPress-Coding-Standards/issues/1762

Code example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Correct.
function foo( &...$spread ) {
    bar( ...$spread );
 
    bar(
        array( ...$foo ),
        ...array_values( $keyed_array )
    );
}
 
// Incorrect.
function fool( &   ... $spread ) {
    bar(...
             $spread );
 
    bar(
        [...  $foo ],.../*comment*/array_values( $keyed_array )
    );
}
Usage in WordPress Core

The spread operator for packing arguments in function declarations and unpacking them in function calls has been introduced in WordPress Core in WP 5.3 and can be freely used when appropriate.

If you want to learn more about the caveats of when the spread operator can/can not be used, reading the implementation notes in the associated Trac ticket is highly recommended.

The spread operator can not be used to unpack arrays until the minimum PHP version has been raised to PHP 7.4.

instanceof, pow **, pow equals **=, spaceship <=>, null coalesce ?? and null coalesce equals ??=

The already existing rules regarding operators apply:

Always put spaces on both sides of logical, comparison, string and assignment operators.

Equality operators in blocks of code should be aligned for readability.

Usage in WordPress Core

instanceof could already be used in WordPress Core and it is encouraged to use this operator instead of a function call to is_a() as it is more performant.

The pow ** and pow equals **= operators can be freely used in WordPress Core and have been introduced in WP 5.3.

The spaceship <=>, null coalesce ?? and null coalesce equals ??= operators can not be used in WordPress Core until the minimum PHP version has been raised to PHP 7.0 (spaceship and null coalesce) or PHP 7.4 (null coalesce equals).

Additional new rules

One class-like definition per file

Proposed standards:

  1. There should only be one class-like definition (class/trait/interface) per file.

This has already been a best practice for a while and will now be formalized.

Related open WPCS PR: http://wayback.fauppsala.se:80/wayback/20200321162927/https://github.com/WordPress/WordPress-Coding-Standards/pull/1802

Visibility should always be declared

Proposed standards:

  1. For all constructs which allow it (properties, methods), visibility should be explicitly declared.
  2. Using the var keyword for property declarations is not allowed.

This has already been a best practice for a while and will now be formalized.

Code example

1
2
3
4
5
6
7
8
9
10
11
12
13
// Correct.
class Foo {
    public $foo;
 
    protected function bar() {}
}
 
// Incorrect.
class Foo {
    var $foo;
 
    function bar() {}
}

Usage in WordPress Core

If any visibility modifiers are missing in WordPress Core code, they should be set to public so as not to break backward-compatibility.

Visibility for class constants can not be used in WordPress Core until the minimum PHP version has been raised to PHP 7.1 (and won’t be enforced until that time).

Property and method modifier order

Proposed standards:

  1. When using multiple modifiers for a property or method declaration, the order should be as follows:
    1. First the optional abstract or final keyword.
    2. Next a visibility keyword.
    3. Lastly, the optional static keyword.

This has already been a best practice for a while and will now be formalized.

Code example

1
2
3
4
5
6
7
8
9
10
11
12
13
// Correct.
abstract class Foo {
    public static $foo;
 
    abstract protected static function bar();
}
 
// Incorrect.
abstract class Foo {
    static public $foo;
 
    static abstract protected function bar();
}

Object instantiation

Proposed standards:

  1. When instantiating a new instance of an object, parenthesis must always be used, even when not strictly necessary.
  2. There should be no space between the name of the class being instantiated and the opening parenthesis.
  3. Assigning the return value of an object instantiation by reference is not allowed.
    New by reference has not been supported by PHP for quite a long while now.

This has already been a best practice for a while and will now be formalized.

Code example

1
2
3
4
5
6
7
8
// Correct.
$foo = new Foo();
$anon = new class() { ... };
$instance = new static();
 
// Incorrect.
$foo = & new Foo;
$foo = new Foo ();

Function closing brace

Proposed standards:

  1. There should be no blank line between the content of a function and the function’s closing brace.

Code example

1
2
3
4
5
6
7
8
9
10
// Correct.
function foo() {
    // Do something.
}
 
// Incorrect.
function foo() {
    // Do something.
 
}

Method chaining

Proposed standards:

  1. When chaining method calls over multiple lines, subsequent lines should be indented at least one tab in from the start of the statement and have no more than one tab indent difference between the indentation of the current line and indentation of the previous line.
  2. The arrow should be placed on the same line as the subsequent method call.

Code example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Correct.
$someObject
    ->doSomething()
    ->doSomethingElse();
 
$someObject
    ->startSomething()
        ->someOtherFunc(23, 42)
    ->endSomething();
 
// Incorrect.
$someObject
        ->startSomething()->
            someOtherFunc(23, 42)
    ->endSomething();

Include/Require

Proposed standards:

  1. No parentheses shall be used for include[_once] and require[_once] statements.
    As include[_once] and require[_once] are language constructs, they do not need parentheses around the path.
  2. There should be exactly one space between the include[_once] and require[_once] keyword and the start of the path.
  3. It is strongly recommended to use require[_once] for unconditional includes.
    When using include[_once] PHP will throw a warning when the file is not found, but will continue execution which will almost certainly lead to other errors/warnings/notices being thrown if your application depends on the file being available, potentially leading to security leaks. For that reason, require[_once] is generally the better choice as it will throw a Fatal Error if the file cannot be found.

This has already been a best practice for a while and will now be formalized.

Related open WPCS PR: http://wayback.fauppsala.se:80/wayback/20200321162927/https://github.com/WordPress/WordPress-Coding-Standards/pull/1862

Code example

1
2
3
4
5
// Correct.
require_once ABSPATH . 'filename.php';
 
// Incorrect.
include_once  ( ABSPATH . 'filename.php' );

Increment/decrement operators

Proposed standards:

  1. There should be no space between an increment/decrement operator and the variable it applies to.
  2. Pre-increment/decrement should be favoured over post-increment/decrement for stand-alone statements.
    “Pre” will in/decrement and then return, “post” will return and then in/decrement.
    Using the “pre” version is slightly more performant and can prevent future bugs when code gets moved around.

Related open WPCS issue: http://wayback.fauppsala.se:80/wayback/20200321162927/https://github.com/WordPress/WordPress-Coding-Standards/issues/1511

Code example

1
2
3
4
5
6
7
8
9
// Correct.
for ( $i = 0; $i < 10; $i++ ) {}
 
--$a;
 
// Incorrect.
for ( $i = 0; $i < 10; $i ++ ) {}
 
$a--;

Magic constants

Proposed standards:

  1. The PHP native __...__ magic constants should be in uppercase when used.

Code example

1
2
3
4
5
6
7
8
9
// Correct.
add_action( 'action_name', array( __CLASS__, 'method_name' ) );
 
require_once __DIR__ . '/relative-path/file-name.php';
 
// Incorrect.
add_action( 'action_name', array( __class__, 'method_name' ) );
 
require_once __dIr__ . '/relative-path/file-name.php';

Shell commands

Proposed standards:

  1. Use of the backtick operator is not allowed.

This has already been a best practice for a while and will now be formalized.

Complex control structure conditions

A control structure statement with multiple conditions can make for very long lines making code harder to read.

It is encouraged (but not enforced) that these long conditions are split into multiple lines.

When a long condition statement is split over multiple lines, the following (new) rules are proposed in addition to the existing rules for control structure formatting:

  1. The first condition should be on the same line as the control structure keyword.
  2. The closing parenthesis for the control structure should be on a new line, indented the same as the control structure keyword and followed by a space and the opening curly brace of the control structure.
  3. When splitting the conditions into multiple lines, the boolean/logical operators separating the statements should always be placed at the start of the new line.
    This makes for smaller change-sets and improves readability.

Note: even with conditions spread out over multiple lines, multiple conditions per line will still be allowed as long as the condition grouping makes sense.

Code example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Single line is allowed.
if ( function_call( $a, $b, $c ) === false && ( isset( $d, $e, $f ) && function_call( $d, $e, $f ) === true ) && function_call( $g, $h, $i ) === false ) {
    // Do something.
}
 
// Correct formatting when using multi-line:
if ( function_call( $a, $b, $c ) === false
    && ( isset( $d, $e, $f ) && function_call( $d, $e, $f ) === true )
    && function_call( $g, $h, $i ) === false
) {
    // Do something.
}
 
// Incorrect formatting when using multi-line:
if (
    function_call( $a, $b, $c ) === false &&
    ( isset( $d, $e, $f ) && function_call( $d, $e, $f ) === true )
    && function_call( $g, $h, $i ) === false ) {
    // Do something.
}

Feedback

Feedback on the standards proposed here is welcome in the comments.

If there are other PHP constructs and language features for which you’d like to see coding standards defined, please open an issue in the WordPress Coding Standards GitHub repository.

Kind request: while I realize that the existing stance on disallowing short array syntax is a hot topic for some people, please do not pollute the discussion about the standards which are currently being proposed by re-opening that discussion in the comments.
Short array syntax will be revisited at a later time, but is not part of the current proposal. Thank you in advance for your understanding.

Previous posts on this subject:

Props: Graceful thanks go out to @dingo_d, @garyj, @netweb, @nielsdeblaauw, @pento, @schlessera, and @SergeyBiryukov for reviewing this post prior to publication.

#modernizewp, #codingstandards, #php, #wpcs

Great step in the right direction! Standardizing modern constructs for WordPress helps the entire ecosystem.

Why are we still using class-, interface-, and trait- file naming conventions? Seems like this is a good opportunity to support this legacy mechanism (even for core), while opening up PSR-4 autoloading options for distributable plugins?

Plugins have the freedom to deviate from the above, if they so choose.

As side-note: classmap based autoloading is much more performant than PSR-4 and the current proposal does not inhibit that at all.

Sure but it’s not ideal for development as you have to regen the classmap every time you add a new class.

Dev-convenience should not be a reason for bad choices for production.
Regen of a classmap can be automated if needs be.

That’s not entirely true. Autoloading has the ability to generate a classmap using composer dump-autoload --optimize-autoloader.

Sorry, just checking – but what about my statement isn’t true ? Your example, to me, just seems to confirm and harden what I said.

PSR-4 Autoloaders is the most easiest to pickup, so I would ask to have:
/Models/Car/GreatCar.php – class
/Models/Car/CarTrait.php – Trait
/Models/Car/CarInferface.php – Interface
/Models/Car/AbstractCar.php – abstract class

Also do not forget to follow as much as possible of PSR-2.
And I DO NOT think that we must required spaces inside IF’s brackets, meaning, this should be valid:

1
2
3
4
if ($a)
{
 <...>
}

And this as well

1
add_action('action_name', array( __CLASS__, 'method_name'));

Those extra spaces SLOWS down the coding speed, and ARE NOT described in PSR-2 coding standard.

add_action(‘action_name’, array(__CLASS__, ‘method_name’));

PSR2 has been superseded by PSR12, so PSR2 is not relevant anymore.

A lot of the current proposals are in line with PSR12, but this proposal is not about changing existing standard (spaces inside parentheses), it is about adding to them and clarifying them where necessary.

As Juliette mentioned, in the themes and plugins, you are free to use whatever you want. These are more WP core related standards that you can but don’t have to, follow in your themes/plugins.

Oh and I recommend using PSR-12, it’s a superset of PSR-2 with more emphasis on modern coding practices 🙂

However, through the entire article, there are recommendations and then core recommendations. So it seems their is confusion about this. If this is mainly core, why are there specific callouts for “Core usage”?

These standards are for the whole WP community and will apply to WP Core development.
Plugins and themes have the freedom to choose to adopt them or not.

As some of these standards involve PHP features which may not be available for use yet in WP Core, due to either ongoing architectural discussions or due to the minimum PHP version not being high enough, I’ve chosen to clarify when certain features can be used in WP Core.
Again, plugins and themes can choose to use a different minimum PHP version, so those asides may not apply to them.

The one about method chaining makes no sense. Is the example for correct code actually correct?

Yes. What do you think is wrong with it ?

three arrows but the middle one indented more than the others

That’s under the new rules allowed, but not required.

The additional indentation in the middle is unexpected. There should probably be a second example without such extra indentation.

Good point. I’ve added an extra example now.

It just doesn’t seem to match what the rule said. It seemed like the rule was saying that each chained method would be indented more. But that seems hard to read. And the way that correct code looks is hard to read.

Using the array keyword in type declarations is strongly discouraged for now, as most often, it would be better to use iterable to allow for more flexibility in the implementation and that keyword is not yet available for use in WordPress Core until the minimum requirements are upped to PHP 7.1.

This seems off to me. I think in most arrays used in WordPress iterable wouldn’t be a sufficient type since you can’t arbitrarily retrieve a value by a key. So, for instance, wp_insert_post could never be typed as an iterable but could be typed as an array. It is also already being used by WordPress Core in things like populate_site_meta, Recovery Mode, the Customizer, the REST API, etc…

I think we gain value by having an array typehint in those places, and we should continue adding it or even expanding our usage when possible.

If array type declarations would be introduced in those places, it would be a breaking function signature change if this would later be changed to iterable (or `ArrayAccess` etc) when the underlying structure would be changed to a Value Object, for instance, with the option remaining to pass in an array instead of the Value Object.

As WP is notorious for avoiding breaking changes, introducing array type declarations would inhibit those type of refactors of underlying structures for the future, which IMO is detrimental to the project as a whole.

Let’s take a look at populate_site_meta for instance. Let’s say we wanted to add support to passing in an ArrayAccess instance. We’d simply remove the array type declaration. If the function currently had no type signature, then adding ArrayAccess as a signature would be a BC break because anyone who is passing an array would now have their code broken.

Now, let’s say we change it to iterable. Well then there isn’t any BC break to the function signature since an array would be accepted there.

However, the body of the function would require changes. For instance, we’d need to immediately convert the iterable to an array since we filter that value. And any code that used that filter to `unset` an item of the list would break if it was passed a generator, for instance. ( not to mention the fact that you would have issues if more than one person iterated over that list, since you can’t rewind generators ).

As WP is notorious for avoiding breaking changes, introducing array type declarations would inhibit those type of refactors of underlying structures for the future, which IMO is detrimental to the project as a whole.

The only place where we’d have a BC issue in the signature ( going from array to iterable ) would be in an API where it was expected & supported for the user to override the method. ( Adding the type signature at all would be a BC break as well. ) But ignoring all that, just changing to support an iterable would be a BC break as well, even if you didn’t do any signature changes for the same reason I mentioned in the previous paragraph. If the code isn’t expecting an iterable, and only an array, than there are a myriad of different ways the code could break.

The signature merely enforces the actual breakage that would be occurring.

As WP is notorious for avoiding breaking changes, introducing array type declarations would inhibit those type of refactors of underlying structures for the future, which IMO is detrimental to the project as a whole.

I see this “notoriousness” as a big plus for WordPress and a big win for all WordPress users. It’s probably one of the reason that led to 35% of all websites on the Internet using WordPress 🙂

I’d be firmly against any changes to the PHP Coding Standards that even remotely suggest possible breakage of backwards compatibility.

Glad you agree. My use of notorious meant exactly that and is why the use of array type declarations is being discouraged for the time being.

Thank you @jrf for the work and for this detailed post. It’s nice to see all of these being standardised in WordPress <3

If we are going PSR4 why not split cores into packages just like Gutenberg and we can only include packages we wnat.

And also with dependency injection pattern we can achieve much more

Please join the discussion about the future architecture of WordPress for that.

This article is not about that.

@jrf Wow, this is a -HUGE- post, thanks for putting it all together! Most of the changes look pretty good, but see several that would need more considerations/refining or more reasoning.

Thinking this is probably not the best format for a discussion. There are a lot of cases and descriptions making it pretty difficult to follow and comment on all of them.

As far as I see there are three groups of proposals for the WordPress PHP Coding Standards here:
1. Proposals for additions to the standards.
2. Proposals for changes of the current standards.
3. Suggestions for clarifications of some standards.

I’d think it would be quite better to make the proposals for additions and changes in separate posts so they can be discussed properly.

For example the proposals around formatting of namespace declarations and related additions would be much easier to discuss (and make a decision) if they were in a separate post. Same for the proposals for changes and additions to classes and class related code formatting.

The proposals for changes to the current standards would definitely be better discussed in another post. Ideally there will be reasons why the standard should change and examples of other popular standards.

The suggestions for clarifications of existing standards should also be considered carefully, ideally in a separate post.

@azaozz I understand your suggestion for splitting it in several posts and will keep it in mind for the future.
The current proposals, however, are all additions to the current standards. A separate post will be published in the future with proposals for changing some of the existing standards.

In the mean time, a number of the current proposals have their own WPCS issue, so if it would make you more comfortable discussing them one by one, commenting on those may be the way to go.

Another consideration should probably be the syncing (or overlapping) between the PHP and JavaScript standards. There’s a recent post about changes to the JavaScript coding standards to facilitate adopting of Prettier (with some tweaks). I won’t be surprised to see the CSS coding standards adopting it too.

There is also a community effort to make a PHP plugin for Prettier which probably deserves a look 🙂

Interesting, but not all that applicable. Using JS tooling for JS and PHP tooling for PHP makes a lot more sense to me.

From what I can see, available rules are limited, though CSFixer integration is possible (not PHPCS though).
Either way I don’t think that tooling will be suitable, for the same reasons PHPCS is used over CS-Fixer: it doesn’t allow for any issues to be reported which are not auto-fixable and especially with the security checks build into WPCS, it is necessary to be able to report issues without auto-fixing them.

Why just not to apply PSR12 to WP Core? Maybe in the past WordPress (community) needed own coding standards in due to absence global PHP community standards. But nowadays it is no longer necessary to support own Coding Standards because it is some kind of reinvention of the wheel that only slows down WordPress development.

In my opinion, WordPress need to migrate to common standards of PHP Community. There is no any problems backward compatibility. We can create compatibility layer for current class naming with class_alias() function. It is not a problem to write some automation script that do most part of renaming work.

WordPress are biggest platform in the Internet and WordPress should be the leader of the entire PHP-community, not the catch-up. I will repeat myself and there is no any big problem to create compatibility layer and write code with modern standards and approaches. This changes will open the way for many new developers from other platforms and frameworks.

Ideally, as said @meshakeeb, WordPress need to be splited to few packages by default which make development much easier. WordPress officially should be something bigger than simple CMS for blogging. In fact, it happened many years ago. But it is another topic for discussion.

Amazing post!

Waiting to see all the errors reported on my usual coding with WPCS 😂

CSS Chat Summary: 19th March 2020

Full meeting transcript on Slack: http://wayback.fauppsala.se:80/wayback/20200321162927/https://wordpress.slack.com/archives/CQ7V4966Q/p1584651672176800

I (@isabel_brison) facilitated the meeting. 

CSS audit updates

  • I tested some automated tools we might use for the audit and updated 49638 with my findings;
  • @notlaura attended the design meeting and asked what designers would find useful with this audit (summary here).

Todoes

  • Create a doc for the audit outline.
  • Ask the accessibility folks what they would find useful as an audit outcome.

We also discussed and agreed on reviewing, as part of the audit, where we are using px units and others that might have a detrimental effect on responsive behaviour. 

Coding standards

I asked about the history of stylelint-config-wordpress, which is used in Gutenberg but predates it by a few years. 

@netweb later replied with some informative context that I will add here:

  • The Stylelint config was created with Core in mind, based on existing styles and in alignment with PHP and JS standards.
  • It was then updated when added to Gutenberg, especially the Sass-specific rules.
  • It wasn’t added to Core because it was picking up lots of errors that would need to be fixed, so needed a committer to own the work.

The discussion then shifted to use of Grunt and Sass in Core. Sass is mainly used for theming in wp-admin, and the design team are looking at replacing its use with CSS custom properties. 

(@netweb later added that because Sass is widely used in Gutenberg this may be up for discussion, but likely Core will be dropping Grunt and moving to native npm scripts and @wordpress/scripts.)

This led to a discussion on IE support and graceful degradation. I suggested defining a set of rules for what is essential functionality that we need to support in IE, so we can be more confident in using shiny new tech for non-essential functionality. @michael-arestad suggested creating a ticket for that.

@michael-arestad expects that the biggest challenge post-audit will be implementing a predetermined selector format in a way that doesn’t break plugins with custom admin sections that depend on wp-admin styles. 

#core-css, #summary

Associating GitHub accounts with WordPress.org profiles

In an effort to make tracking all contributions to the WordPress project across multiple locations easier, a new option is available when editing your WordPress.org profile that allows you to connect your GitHub account.

WordPress.org profile with GitHub profile link highlighted.

In recent releases, the process of collecting props for non-WordPress.org contributions (namely Gutenberg) has been highly manual and error prone, occasionally resulting in contributors not receiving proper credit. Connecting your WordPress.org and GitHub accounts will allow automatic tooling to be built which reduces the burden on release teams to maintain a credit list.

How it works

The feature uses an oAuth flow to grant a WordPress GitHub application read-only access to your GitHub account’s public information. This proves that you own both the GitHub account and the WordPress.org account and links the two accounts.

This has been available and tested for several months now, and many contributors have connected their accounts. But, because it was never officially announced, adoption has been low.

If you have not already, please take a moment to connect your GitHub account to your WordPress.org account by going to http://wayback.fauppsala.se:80/wayback/20200321162927/https://profiles.wordpress.org/me/profile/edit/.

Below are some screenshots of how the process works.

1. Edit WordPress.org profile

WordPress.org profile edit screen with the GitHub Username section highlighted.
Click “link your GitHub account” to initiate the process.

2. Authorize WordPress.org Profiles application

The authorization screen on GitHub for the WordPress.org Profiles application.
Grant the WordPress Profiles GitHub application read-only access to your public information.

3. Verify connection

WordPress.org profile edit screen showing a linked GitHub profile.
Access can be revoked at any time on the Edit Profile screen on WordPress.org.

Huge props go out to @dd32 for implementing this feature. For more information on this feature and the ongoing effort to make collecting props easier, see Meta-#4447.

Any chance we’ll see this bring GitLab into the fold as well?

There are currently no official WordPress core related projects on GitLab. So there are no plans to bring GitLab into the fray (which is highly unlikely).

The only purpose of this feature is to provide a way for contributors to link their GitHub account to their .org account so that their contributions can be tracked. It is not meant to be the same as the “Find me on:” section where you can link to various social networks.

Thank you for this! It’s been a challenge collecting the props for contributions to Gutenberg, and hopefully this will make is easier for them to get their due!

This is really great, and I’m glad there’s a more reliable way to be attributing credit to contributors to the Gutenberg project.

I’ve been thinking about a few additional “nice-to-have”s:

1. It would be nice if there was a single link we could provide to help direct people to link these accounts. From the original post:

If you have not already, please take a moment to connect your GitHub account to your WordPress.org account by going to http://wayback.fauppsala.se:80/wayback/20200321162927/https://profiles.wordpress.org/YOUR-USERNAME/profile/edit.

The manual process of replacing “YOUR-USERNAME” is, in my mind, an unnecessary barrier (at least one that could technically be eliminated). Just like http://wayback.fauppsala.se:80/wayback/20200321162927/https://profiles.wordpress.org/ will redirect to one’s own profile if logged in, it would be great if there was a similar canonical link for directing to the exact page where this linking occurs.

2. Are there any public APIs for returning the WordPress.org account name associated with a GitHub account name? I assume something like this would at least need to exist internally to do the release credit attribution. Might there be any plans to open this up?

3. Both of the prior points would facilitate a third idea I’ve been thinking about on the Gutenberg side of things:

http://wayback.fauppsala.se:80/wayback/20200321162927/https://github.com/WordPress/gutenberg/projects/24#card-34839803

Ideally we could automate the process of requesting this information of a contributor whose pull request has been merged, but who is not known to be associated with a WordPress.org account.

I already corrected the link in the post; the redirect to your profile happens with http://wayback.fauppsala.se:80/wayback/20200321162927/https://profiles.wordpress.org/profile/profile/edit.

Thanks, @ocean90! I couldn’t figure out the appropriate link.

When I click on this link, it does take me to my profile, but it’s the profile “Home” page, not the “Edit Profile” page where the account linking happens.

In other words, it takes me here:

http://wayback.fauppsala.se:80/wayback/20200321162927/https://profiles.wordpress.org/aduth/profile/

I am also seeing two error notices, each with the text:

You do not have access to that page.

Edit: Maybe this is related to what @tjnowell was experiencing based on his comment below.

That link doesn’t seem to work for me, it just opens my profile with a couple of “You do not have access to that page” errors.

This is broken if you’ve already entered your github username in before the feature was added. It shows red banners on your profile saying that you don’t have access to view that page, just below the badges.

I had to edit my profile to remove the github username, then authenticate with GH to get it working again

What field had you used for the username? This doesn’t actually utilise a profile field at all, and AFAIK there wasn’t a GitHub field at all prior to launching it.

Is there a possibility of linking to a GitHub organization?

When props are given for WordPress contributions, they are generally given to the individuals making the contributions and not companies. I don’t believe that organizations on GitHub can make commits (I could be wrong). I don’t know that I see the benefit to adding support for this as it doesn’t contribute to the goal of helping to better track contributions.

Also worth mentioning that WordPress.org does not currently make a distinction between organizations and individuals. It would be a bit weird to connect an organization to an individual profile.

Can you elaborate a bit? Do you mean that the criteria for the Core team should be expanded to reflect contributions to Gutenberg are counted if their .org account is linked to GitHub?

All contributors and team members, please update your profiles. Thank you.

+make.wordpress.org/docs

Also, thanks to everyone working on this. Trying to find every contributor was a bit of a nightmare. You rock!

I tested yesterday (also to see if we need to some changes to VVV).
Pull request http://wayback.fauppsala.se:80/wayback/20200321162927/https://github.com/WordPress/wordpress-develop/pull/195 but there are some problems with travis and docker looking at the log
Also the ticket http://wayback.fauppsala.se:80/wayback/20200321162927/https://core.trac.wordpress.org/ticket/47733 is mentioned but doesn’t results at http://wayback.fauppsala.se:80/wayback/20200321162927/https://core.trac.wordpress.org/my-patches so is difficult to track on what I am working on.

Also the codestyle http://wayback.fauppsala.se:80/wayback/20200321162927/https://travis-ci.com/github/WordPress/wordpress-develop/jobs/300481374 report errors of other files. I think that should act only on the patch involved and not all the wordpress files.

Release Model Working Group Chat Postponed

Sorry for the very late notice, but tonight @amykamala and I are not able to host the chat.

However, if you are interested in working on it async, here are some issues that need help.

See you on April 1t (no joke!)

#release-process

Not a problem! Right now the important thing is to get all the sleep we can, and keep sane hours. (And it just occurred to our veterinarian right now that he needs a social-distance policy! So, editing and laying out and posting …)

Dev Chat Agenda for March 18, 2020 (5.4 Week 10)

Here is the agenda for the weekly meeting happening later today: Wednesday, March 18, 2020, at 09:00 PM UTC.

Announcements

WordPress 5.4 Release Candidate 3 landed yesterday, March 18, as scheduled.

Upcoming Releases

The current major is 5.4; please keep testing for all the bugs. At the same time, trunk has branched to 5.5 as of RC1. That means 5.5 is officially in alpha.

Final release is March 31.

Components Check-in

  • News from components
  • Components that need help
  • Cross-component collaboration

Open Floor

Got something to propose for the agenda, or a specific item relevant to our standard list above?

Please leave a comment, and say whether or not you’ll be in the chat, so the group can either give you the floor or bring up your topic for you, accordingly.

This meeting happens in the #core channel. To join the meeting, you’ll need an account on the Making WordPress Slack.

#5-4, #agenda, #devchat

RE: 5.5 in alpha
If you have a feature you’re building (or want to build), this is the time to open that ticket and, if you’d like some help, you can get it. The idea is to have it mostly done by the time dev chat starts focusing on it, which is generally four to six weeks out from beta

Editor chat Summary: 18 March, 2020

This post summarizes the weekly editor chat meeting (agenda here) held on Wednesday, 18th March 2020 in Slack. Moderated by @jorgefilipecosta.

Opening Remarks

WordPress 5.4 Upcoming Release

  • WordPress 5.4 RC3 was released yesterday [17 March 2020].
  • Details of the editor fixes included in the release can be found on Github.
  • Next Monday [23 March 2020] will be the package publish date for the next RC.
  • [As of 18 March 2010] there are 3 days left to merge things for WordPress 5.4 that will be tested during the RC period.
  • Todo list for WordPress 5.4 is on the Github project board.
  • 🙏The Core team are looking for folks to help with Reviews and PRs.

Gutenberg version 7.7.0

Monthly Plan / Weekly Priorities

Task Coordination Summary

Tasks that folks have been working on or that they plan to work on:

Points from the Open Floor

👀 Needs review

The following items require review and/or input:

Auto-updates feature meeting summary: March 17th, 2020

These are the weekly notes for the WP Auto-updates team meeting that happened on Tuesday March 17th, 2020. You can read the full transcript on the core-auto-updates Slack channel.

As a reminder, the Feature Plugin is developed on GitHub and is available for testing on WordPress.org plugins repository.

Current status of the project – version 0.3 🦉

Version 0.3.0 was released on Monday 16th. This release addresses a number of issues and introduces Email Notifications.

Changelog:

  • Add functions to handle plugins updates notification emails – PR 54
  • Remove update time text after manual update – PR 43
  • Ensure “Automatic Updates” column is not added if no content would be output in the column – PR 57
  • Specific messages for delayed or disabled cron events – PR 58
  • Prevent mis-match between count in Auto-updates Enabled view and the number of plugins displayed for that view by applying ‘all_plugins’ filter before computing that count. – PR 59

Thanks @pbiron for his invaluable help on version 0.3.

@audrasjb shared a screenshot with an example of email notification:

Please feel free to propose string changes to this first implementation of email notifications.

Version 0.4.0 will focus on backporting every auto-updates features to Themes. @audrasjb to merge this pull request as a first step for the work on themes support. Then, the idea is to open pull requests for each function/feature to be backported, so it’s easier to track progress on themes support.

@bookdude13 asked whether it’s better to open up issues to break up the work on the themes port, or to directly address them with pull requests.

@audrasjb will open an issue to list all the functions/feature that need proper backport and to track the team’s progression.

There is also a few background tasks opened by @jeffpaul concerning the GitHub repository.

Concerning Email notifications, @joostdevalk proposed to add links to the plugins changelog in those emails. @pbiron answered that it might be hard for plugins/themes not in the WordPress.org repo. @joostdevalk proposed to make it filterable. @audrasjb proposed to make the notification entirely filterable. @joostdevalk felt concerned about plugins that would override the email even when multiple plugins are updated at once.

@afragen proposed to use a filter that could be specific for each, like for example:
apply_filters( 'wp_autoupdates_email', $text, $slug )

This item will be discussed again during the next team meeting.

@pbiron wanted to discuss a specific pull request. It proposes to add filters to control whether the Enable/Disable buttons appear in the UI for a given plugin. @pbiron and @audrasjb agreed that having a filter that is specific to the UI is not the way to go and it is to be filterable then the existing auto_update_plugin hook should be used. For now, the pull request will stay open for further discussion.

Next meeting is planned on Tuesday March 24, 2020 at 18:00 UTC and will take place on #core-auto-updates Slack channel.

#auto-update, #feature-plugins, #feature-projects, #feature-autoupdates

CSS Chat Agenda: 19th March 2020

This is the agenda for the upcoming CSS meeting scheduled for Thursday, March 19, 2020 at 09:00 PM UTC.

This meeting will be held in the #core-css channel  in the Making WordPress Slack.

If there’s any topic you’d like to discuss, please leave a comment below!

Agenda

  • CSS audit status update
  • Coding standards: differences between Core and Gutenberg
  • Open floor

#agenda, #core-css

JavaScript Chat Summary: March 17, 2020

Below is a summary of the discussion from this week’s JavaScript chat (agendaSlack transcript).

Have a topic for discussion for the next meeting? Leave a suggested edit on next week’s agenda.

Agenda Items

JSDoc Documentation Standards

(Slack conversation)

Question: Does it make sense to document changes to a function over time, and if so, how?

Context: http://wayback.fauppsala.se:80/wayback/20200321162927/https://github.com/WordPress/gutenberg/pull/20427#discussion_r386396607

The current JavaScript documentation standards restrict the @since tag to include only the version number:

@since x.x.x: Should always be 3-digit (e.g. @since 3.6.0).

This is in contrast to the PHP documentation standards, which include guidelines around using @since as a changelog:

If significant changes have been made to a function, hook, class, or method, additional @since tags, versions, and descriptions should be added to provide a changelog for that function.

Proposal: Incorporate some adaptation of the PHP since changelog guidelines into the JavaScript inline documentation standards.

Discussion Points:

  • @nerrad asks if this could be used to pull documentation automatically from the source code. This is quite possible, and is likely exactly what is done with the PHP source code documentation (example documentation and source).

Action Items:

  • Update the JS documentation standards, assuming there is no opposition presented in the coming days.
  • Disable the JSDoc since format validation for Gutenberg in the related changelog (already done)

News Roundup

This roundup contains a few links for Gutenberg and JavaScript related news curated (and commented on) by @nerrad

Other Random Stuff:

#core-js, #javascript