Oct. 14: Edited to include relevant ticket Created for both bug reports and feature development on the bug tracker. numbers for each External Library update.
Oct. 15: Corrected the jQueryColor updated from version and added a bullet point about the changes to the random_password
filter Filters 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..
Oct. 29: Added Lodash, React React is a JavaScript library that makes it easy to reason about, construct, and maintain stateless and stateful user interfaces. https://reactjs.org/., and ReactDOM to the list of updated external libraries.
In WordPress 5.3, a large handful of small developer-focused changes were made that deserve to be called out. Let’s take a look!
Passing Arrays to Supports Argument When Registering Post Types
When registering post type support for a feature using add_post_type_support()
, it’s possible to pass “extra” arguments to provide more details for how that post type should support the feature.
<?php
add_post_type_support(
'my_post_type',
array(
'custom_feature' => array(
'setting-1' => 'value',
'setting-2' => 'value',
),
)
);
However, passing multidimensional arrays with advanced configuration details to the supports
argument in register_post_type()
results in the extra arguments getting stripped before being added to the post type.
This has been fixed in WordPress 5.3 and multidimensional arrays can now be passed to supports
in register_post_type()
.
Example
<?php
register_post_type(
'my_post_type',
array(
...
'supports' => array(
'title',
'editor',
'custom_feature' => array(
'setting-1' => 'value',
'setting-2' => 'value',
),
),
...
)
);
For more information on this change, see #40413 on Trac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress..
HTML5 Supports Argument for Script and Style Tags
In HTML5, the type
attribute is not required for the <script>
and <style>
tags. Including the attribute on these tags (type="text/javascript"
, for example) will trigger a validation warning in HTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. validation tools.
In WordPress 5.3, two new arguments are now supported for the html5
theme feature, script
and style
. When these arguments are passed, the type
attribute will not be output for those tags.
Example
<?php
function mytheme_register_support() {
add_theme_support( 'html5', array( 'script', 'style' ) );
}
add_action( 'after_setup_theme', 'mytheme_register_support' );
For more information on this change, see #42804 on Trac.
Recording Additional Information For Saved Queries.
When the SAVEQUERIES
constant is set to true
, an array of data for every query to the database is logged for debugging purposes. This data includes:
- The query itself
- The total time spent on the query
- A comma separated list of the calling functions
- The Unix timestamp of the time at the start of the query.
A new filter, log_query_custom_data
, has been added to allow custom debugging information to be added to this array of data. A good example where this would be useful is a plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party that runs a custom search implementation (such as Elasticsearch). “This query was served by Elasticsearch” could be added to the debug data to help trace where queries are being served.
Example
<?php
function myplugin_log_query_custom_data( $query_data, $query, $query_time, $query_callstack, $query_start ) {
$query_data['myplugin'] = 'Custom debug information';
return $query_data;
}
add_filter( 'log_query_custom_data', 'myplugin_log_query_custom_data', 10, 5 );
For more information, see #42151.
Unit-less CSS Cascading Style Sheets. line-height Values
Line height should also be unit-less, unless necessary to be defined as a specific pixel value.
The WordPress Core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. CSS Coding Standards
This standard was not followed consistently in the WordPress Core CSS files. All 346 line-height
style definitions in Core have been individually examined and adjusted to now adhere to this coding standard.
This change will not cause any issues with Core admin (and super admin) CSS or custom styling, but sites with custom admin styling should be double checked just to be sure.
For more details, see #44643 on Trac, or any of the related sub-tickets (#46488, #46489, #46492, #46493, #46494, #46495, #46509, #46510, #46511, #46512, #46513, #46514, #46515, #46516, #46517, #46518, #46519, #46520, #46521, #46522, #46523, #46524, #46525, #46526, #46528, #46529, #46530, #46531).
Additional Developer Goodies
add_settings_error()
now supports the warning
and info
message types in addition to the error
and updated
/success
styles. error
and updated
types will also now output the .notice-error
and .notice-success
instead of the legacy .error
and .updated
classes (see #44941).- A typo in the
Walker_Nav_Menu_Checklist
class has been fixed for the hidden title attribute input field’s class. Previously, the class was .menu-item-attr_title
. However, the other fields use a hyphen, which the admin JavaScript JavaScript 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/. also expects. For that reason, the class has been changed to .menu-item-attr-title
. This field is used to auto-populate the Title Attribute input field for menu items when adding a menu item. Plugins and themes that extend or that have copied the Walker_Nav_Menu_Checklist
class into their code base should also fix this typo (see #47838). - An index has been added to
wp_options.autoload
. While most sites will be completely unaffected by this, sites with a large number of rows in wp_options
and a small number of autoload
set will see a significant performance improvement (see #24044). - The Media Library type filter has been expanded to include document, spreadsheet, and archive filters (see #38195).
- Autocomplete support has been added for PHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 7.4 or higher mode in the CodeMirror code editor used when using the plugin and theme editors (see #47769).
- Support for
flex
, grid
, and column
layout techniques have been added to the list of CSS attributes that KSES considers safe for inline CSS (see #37248). - The charset used when
wp_die()
is called is no longer hard coded as utf-8
. Instead, utf-8
will be used as a default and a different charset
argument can be passed in the third $args
parameter for wp_die()
(see #46666). - The
sms
protocol has been added to wp_allowed_protocols()
(see #39415). - Support for a custom
WP_PLUGIN_URL
has been added to load_script_textdomain()
. Plugins may not be on the same host/path as the rest of the content. This ensures translations are loaded correctly in this scenario (see #46336). - Three additional parameters (
$length
, $special_chars
, and $extra_special_chars
) are now passed to the random_password
filter in wp_generate_password()
. Previously, code using this filter had no knowledge of the requirements a generated password needed to meet. Now, custom password generators can better utilize the filter instead of overriding the entire pluggable function. (see #47092).
Build/Test Tools
- A new job on TravisCI test builds has been added to scan for potential PHP compatibility issues (see #46152).
- Composer scripts will now use the version of PHPCS PHP Code Sniffer, a popular tool for analyzing code quality. The WordPress Coding Standards rely on PHPCS./PHPCBF installed through Composer, removing the requirement to have them installed globally. The
@php
prefix has also been added to ensure each script runs on the PHP version that Composer used to install dependencies (see #47853). - Installing Grunt globally is no longer required to run build related scripts because Core now uses the local Grunt binary installed by NPM. For example,
npm run build
can now be used instead. (see #47380).
External Libraries
A number of external libraries and dependencies have been updated. Including Twemoji, which now includes the Transgender symbol and flag!
⚧️ 💖 🏳️⚧️
The following external libraries have been updated:
- Backbone.js from 1.3.3 to 1.4.0 (changes, see #47478)
- getID3 from 1.9.14 to a patched version of 1.9.18 (changes, also see the WordPress and PHP 7.4 dev note, and #47751)
- jQueryColor from 2.1.1 to 2.1.2 (changes, see #31511)
- Lodash from 4.17.11 to 4.17.15 (changes)
- MediaElement.js from 4.2.6 to 4.2.13 (changes, see #46681)
- PHPMailer from 5.2.22 to a patched version of 5.2.27 (changes, also see the WordPress and PHP 7.4 dev note, #40472, and #47783)
- React and ReactDOM from 16.8.4 to 16.9.0 (changes, see #48121)
- Requests from 1.7 to a patched version (changes, also see the WordPress and PHP 7.4 dev note, and #47746)
- TinyMCE from 4.9.4 to 4.9.6 (changes, see #47437)
- Twemoji from 12.0.1 to 12.1.2 (changes, see #47852)
Props @earnjam for peer review.
#5-3, #dev-notes