Week In Core, July 6 – July 12 2016

Welcome back the latest issue of Week in CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress., covering changes [37980-38039]. Here are the highlights:

  • 59 commits
  • 39 contributors
  • 61 tickets created
  • 3 tickets reopened
  • 20 tickets closed

Ticketticket Created for both bug reports and feature development on the bug tracker. numbers based on trac timeline for the period above. The following is a summary of commits, organized by component.

Code Changes

Administration

  • Add aria-button-if-js class to links in the media list table that behave like buttons when JavaScriptJavaScript 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 is on. [38031] #26504, #36555

Bootstrap

  • Make wp_is_ini_value_changeable() compatible with PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 7.4 or higher 5.2.6 – 5.2.17. See #32075. [38017] #32075
  • Enhance core’s memory limit handling. Related commits: [38011-38013] [38015] #32075
  • Clean up wp_convert_hr_to_bytes(). [38013] #32075
  • Move wp_convert_hr_to_bytes() to wp-includes/load.php. [38012] #32075
  • Move constants for data sizes before constants for memory limits. [38011] #32075

Comments

Customize

  • Fix panel indentation in Firefox. [37984] #34622
  • Ensure that WP_Customize_Setting::value() can return a previewed value for aggregated multidimensionals. [37982] #37294
  • Ensure that WP_Customize_Nav_Menu_Section is able to represent a placeholder nav menu. [37981] #37293

Docs

  • The $labels property in WP_Post_Type is of type object as returned from get_post_type_labels(), not an array. [38030] #36217
  • Standardize references to “metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. box” or “meta boxes” as two distinct words throughout core documentation per the core spelling guide. [38029] #32246
  • Standardize capitalization of Ajax throughout core documentation per the core spelling guide. [38028] #32246
  • Link the 4.6 changelog entry in the DocBlockdocblock (phpdoc, xref, inline docs) for register_meta() to its corresponding dev notedev note Each 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. on make/core. [38027] #35658, #37318
  • Fix a typo in the DocBlock for themes_api(), themes_api, plugins_api(), and plugins_api. [38025] #32246
  • Fix minor formatting and syntax for wp-admin/* elements introduced in 4.6. [38024] #37318
  • Cross-reference parent classes in DocBlocks for upgrader classes moved to their own files in 4.6 [38023] #36618, #37318
  • Improve usefulness of DocBlocks for ajax-actions.php functions introduced in 4.6. [38022] #37318
  • Fix a typo in the hook doc description for the enable_loading_advanced_cache_dropin run-time filterFilter 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.. [38021] #34936, #37318
  • Fix a typo in an inline hook reference in the DocBlock for comment_form(). [38018] #32246
  • Fix typo in a comment in Core_Upgrader::upgrade(). [38014] #37314
  • Correct the description of the $network_id in WP_Site_Query. [38008] #35791
  • Fix an incorrect @since comment. [37994] #36495
  • Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core. [37985] #36495

Embeds

  • Include localeLocale A 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. stylesheets after default styles. [38010] #36839
  • Don’t print the HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. for a featured imageFeatured image A featured image is the main image used on your blog archive page and is pulled when the post or page is shared on social media. The image can be used to display in widget areas on your site or in a summary list of posts. if a post has no featured image. [37988] #37288

HTTPHTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways.

I18Ni18n Internationalization, 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.

  • I18N: Introduce an on/off switch for locales where comment number needs to be declined. [37987] #13651

Media

  • Don’t use ‘full’ as array key in wp_calculate_image_srcset(). [37986] #36345

Meta

  • Add a missing @since param for wp_object_type_exists(). [38038] #35658
  • Don’t pass an empty $meta_key to get_metadata(). [37996] #35658
  • Introduce an initial set of tests for register_meta(). [37995] #35658
  • Make registration error conditions return consistently. [37991] #
  • Ensure $object_subtype is available before use in register_meta(). [37990] #35658

Multisitemultisite Used 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

  • Use hash_equals() when comparing hashes to mitigate timing attacks. [38032] #37324
  • Correct logic used to display an Edit User link after adding a user. [38007] #37223
  • Add a nonce to the “Cancel” URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org when changing a site’s adminadmin (and super admin) email. [38006] #36954
  • Don’t store max_num_pages in WP_Network_Query query cache. [38003] #32504
  • Don’t store max_num_pages in WP_Site_Query query cache. [38002] #35791

Plugins

  • Improve Ajax search of installed plugins. [38033] #37230
  • In plugin_basename() sort pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. paths before resolving symlinks. [37983] #28441

Resource Hints

  • Remove schemes from dns-prefetch resource hint outputs. [38036] #37240

RevisionsRevisions The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision.

TaxonomyTaxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies.

  • Remove an unnecessary double assignment in WP_Term_Query::get_terms(). [38020] #37254

Tests

  • Don’t change the memory_limit setting during tests. See #32075. [38016] #32075
  • Ensure that test for invalidinvalid A resolution on the bug tracker (and generally common in software development, sometimes also notabug) that indicates the ticket is not a bug, is a support request, or is generally invalid. user ID actually uses an invalid user ID. [38005] #37308
  • Add description for data_get_comments_number_text_declension(). [37997] #13651

Text Changes

Themes

  • PHP 7 compatibility issues fixed in Twenty Thirteen and Twenty Fourteen [38026] #37227

TinyMCE

  • preserve and tags inside the editor. Uses image placeholders for the tags and makes then visible. [38039] #32923
  • update to 4.4.0, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt. [38034] #36434, #37327

Toolbar

  • Allow 0 as a value for the tabindex property of a menu item. [38035] #32495

Upgrade/Install

  • Do not remove event handlers when trying to update a theme. [38019] #37285

Widgets

  • After [37972], ensure that $box['args'] is an array before trying to access __widget_basename. [38004] #35021

Props

Thanks to @A5hleyRich, @adamsilverstein, @afercia, @azaozz, @birgire, @boonebgorges, @DrewAPicture, @elrae, @ericlewis, @Faison, @helen, @iseulde, @jaspermdegroot, @jdgrimes, @jeremyfelt, @joedolson, @joemcgill, @johnbillion, @jrf, @karmatosed, @metodiew, @niallkennedy, @ocean90, @pento, @peterwilsoncc, @rachelbaker, @ramiy, @rmccue, @sc0ttkclark, @scottbasgaard, @SergeyBiryukov, @spacedmonkey, @stubgo, @swissspidy, @valendesigns, @westonruter, @wpfo, @xknown, and @Zuige for their contributions!

#4-6, #week-in-core

Weekly Dev Chat Agenda for July 13 — Twelve Weeks Later

Agenda for the weekly dev meeting on July 13, 2016 at 20:00 UTC:

  • WordPress 4.6 BetaBeta A 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. 3
  • Dev notesdev note Each 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. / Ticketticket Created for both bug reports and feature development on the bug tracker. goals
  • About page / Release video
  • Project updates
  • Component announcements/updates
  • Open discussion

If you have anything to propose to add to the agenda, please leave a comment below.

See you in the chat!

#4-6, #agenda, #dev-chat

dbDelta() updates in 4.6

dbDelta() is a function which helps to modify the database based on specified SQL statements. In WordPress 4.6 this function has been updated to resolve some long standing bugs.

Normalized index definitions

Previously, dbDelta() compared the raw SQL data for index definitions with the output of SHOW INDEX FROM. This required a specific format so indices are not unnecessarily re-created. But this format wasn’t always ensured, until now. See [37583]:

  • dbDelta() now parses the raw index definition to extract the type, name and columns. With this data a normalized definition is build (#20263, #34873).
  • CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. standardize now on uppercase types (#34871) and on ‘KEY’. ‘INDEX’ is only a synonym for ‘KEY’.
  • ASC and DESC definitions are currently unused by MySQLMySQL MySQL is a relational database management system. A database is a structured collection of data where content, configuration and other options are stored. https://www.mysql.com, dbDelta() ignores them now too (#34959).
  • Spaces in index definitions don’t create duplicate indices anymore (#34869).

Backtick all the things

Index names (#20263), index column names (#20263), names in index change queries (#20263) and other queries (#31679) are now escaped with backticks to improve compatibility with names which are reserved keywords.

Support for SPATIAL keys

dbDelta() already supported spatial fields (by virtue of not checking field types), so it’s nice to round that out with spatial key support, too. See #36948.

 

If you’re using dbDelta() in your pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. please test it with WordPress 4.6 and report any issues in the comments or on Trac.

There are still a few issues with dbDelta(), can you help us to fix them? 🔨

#4-6, #database, #dev-notes

WP_Post_Type in 4.6

WordPress 4.6 will introduce a new WP_Post_Type class. This changes the global $wp_post_types to an array of WP_Post_Type objects. WP_Post_Type provides methods to handle post type supports, rewrite rules, metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. boxes, hooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same., and taxonomies. These methods are used internally by register_post_type() and unregister_post_type(). Each post type argument is now a property of WP_Post_Type.

The following functions have been changed to return a WP_Post_Type object:

  • register_post_type()
  • get_post_type_object()

The following hook parameters are now a WP_Post_Type object:

  • The second parameter $post_type of xmlrpc_prepare_post_type.
  • The second parameter $post_type_object of registered_post_type.
  • The third parameter $post_type of nav_menu_items_{$post_type_name}.

The following function accepts a WP_Post_Type object now too:

  • is_post_type_viewable()

For more background on the change, see #36217.

Note that there are plans to introduce a WP_Taxonomy class as well, see #36224.

#4-6, #dev-notes, #posts

This Week in 4.6: July 11 – 17

This is the jump-start post for the twelfth week of the WordPress 4.6 release cycle.

BetaBeta A 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. 3 will land on Wednesday at 18:00 UTC. Our target until then is to get the ticketticket Created for both bug reports and feature development on the bug tracker. count in the 4.6 milestone down to 40. (Beta 4 => 10, RC1 => 0.)

Priority tickets/projects this week:

Meetings this week:

Bug Scrubs

Feature Chats

Weekly Chats

Notable updates from last week:

#4-6, #jump-starts

Multisite Focused Changes in 4.6

The 4.6 release cycle has been a productive one! Several major and a few minor updates are described in detail below. If you’d like even more detail, here is a full list of multisitemultisite Used 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 focused changes for 4.6.

Introduce WP_Site_Query and WP_Network_Query

WordPress 4.6 introduces WP_Site_Query and WP_Network_Query as well as their companion functions, get_sites() and get_networks().

WP_Site_Query

With WP_Site_Query (or get_sites()), sites can now be queried from the $wpdb->blogs table in a flexible way by id, domain, path, and more. For a full list of supported arguments, see the documentation attached to the __construct() method.

New filters and actions associated with this change include parse_site_query, pre_get_sites, the_sites, site_search_columns, sites_clauses, and found_sites_query.

Query results are cached as part of the global sites group. This will provide a performance boost for sites using a persistent object cache.

The introduction of this class helped resolve several long standing issues with WP_MS_Sites_List_Table. Expect to see a faster and more relevant search when browsing through a networknetwork (versus site, blog)’s sites. See #36675.

For the background discussion around these changes, see #35791.

WP_Network_Query

With WP_Network_Query (or get_networks()), networks can now be queried from the $wpdb->site table by id, domain, and path. Query results are cached as part of the global networks group. For a full list of supported arguments, see the documentation attached to the __construct() method.

WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. does not provide a UIUI User interface for managing multiple networks, but any sites using a pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. to do this will start to see a benefit from having this available.

New filters and actions associated with this change include parse_network_query, pre_get_networks, the_networks, networks_clauses, and found_networks_query.

For the background discussion around these changes, see #32504.

Enhancements to WP_Site and WP_Network

New utility methods

New functions get_site() and get_network() have been introduced to retrieve a specific site or network respectively. They both accept either an ID, database object or class instance as the first parameter. If that parameter is omitted, the current site / network is returned.

Property changes on WP_Site and WP_Network

The WP_Site and WP_Network objects now support access to their respective ID properties through property names which match current naming conventions. Furthermore, by accessing the properties with the new names, it is ensured that these are returned as integers rather than strings. The old properties are still accessible and valid, but these changes should encourage developers to use the new property names.

The following is the list of property improvements:

  • $site->id is the site’s ID. (previously $site->blog_id)
  • $site->network_id is the site’s parent network ID. (previously $site->site_id)
  • $network->id is now an integer instead of a string.
  • $network->site_id is the network’s main site ID. (previously $network->blog_id)

For background discussion around these changes, see #36717 and #37050.

Lazy-loading extended properties

Additional properties of a site object normally accessed with get_blog_details() are now automatically lazy-loaded when requested. This allows developers to use get_site() as a replacement for get_blog_details() which is likely to be deprecated in a future release. See #36935.

New Actions and Filters

Several new actions and filters were added as part of the WP_Site_Query and WP_Network_Query changes. Here are some others of note:

  • ms_loaded fires at the end of the multisite bootstrap process in ms-settings.php. At this point the current site and network are available in the global scope. See #37235.
  • pre_get_blogs_of_user allows developers to alter or short-circuit the results of get_blogs_of_user(), which can be an expensive function to run on configurations with many users. See #36707.
  • clean_site_cache fires after cache has been cleared with clear_blog_cache(). This can be useful for clearing any custom cache keys associated with a site record. See #36203.
  • network_edit_site_nav_links filters the list of links displayed at the top of Edit Site views as a “tabbed” interface. See #15800.
  • ms_sites_list_table_query_args filters the arguments passed to WP_Site_Query when building the MS Sites List Table. See #26580.

Other enhancements of note

Introduce get_current_network_id() as a helper function to find the current network’s ID. See #33900.

The MULTISITE and SUBDOMAIN_INSTALL constants can now be overridden in a project’s wp-config.php when running unit tests. See #36567.

Deprecated Functions

wp_get_sites() has been deprecated and get_sites() should be used instead. Please note when making code changes that get_sites() returns an array of WP_Site objects where wp_get_sites() returned an array of arrays.

WP Multi Network compatibility

The introduction of get_networks() in 4.6 conflicts with the function of the same name in WP Multi Network, a plugin commonly used to provide multiple networks on a multisite installation. A fix for this is already in the master branchbranch A directory in Subversion. WordPress uses branches to store the latest development code for each major release (3.9, 4.0, etc.). Branches are then updated with code for any minor releases of that branch. Sometimes, a major version of WordPress and its minor versions are collectively referred to as a "branch", such as "the 4.0 branch". of the plugin, and will be included in the next release. In the same change, many other functions were wrapped in function_exists() calls to prevent similar conflicts in the future. If you are using WP Multi Network, please be sure to update accordingly.

#4-6, #dev-notes, #multisite, #network-sites

Enhancing register_meta() in 4.6

Note: The direction of register_meta() has changed since this was published. Please see the most recent developer note explaining these changes.

In 4.6, register_meta() expands to support the registration of metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. keys and what to expect from those keys. See #35658 for the discussion around this change.

The behavior of register_meta() is similar to register_post_type() in that the registration of this data is stored in the global scope. This makes an object’s meta data more accessible to parts of coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. and extending code.

Why make this change

In 4.5 and earlier, WordPress provided no method to explicitly register a meta key’s public state. Instead, register_meta() provided “protected” and “authenticated” meta. This can be used effectively for some things, particularly to determine what meta appears in the Custom Fields metaboxMetabox A post metabox is a draggable box shown on the post editing screen. Its purpose is to allow the user to select or enter information in addition to the main post content. This information should be related to the post in some way. when editing a post. It can not be used as a basis for arbitrarily showing meta keys and values to unauthenticated visitors.

What does this change involve

A global variable, $wp_meta_keys, contains all registered meta keys.

The function signature of register_meta() has changed to support 3 arguments, the last being an array. That array should contain data about the meta with these key/values:

  • sanitize_callback, a callable method to provide sanitization. This is the new version of the current 3rd parameter in register_meta().
  • auth_callback, a callable method to provide authorization. This is the new version of the current 4th parameter in register_meta().
  • object_subtype, a string containing an object subtype slug. If there is no object subtype, meta will not be registered and a WP_Error will be returned instead.
  • type, a string indicating what type of data the meta value will be. This is intentionally not restricted to a specific list of data types, however full names should be used when possible. (e.g. boolean, integer)
  • description, a string containing a basic description of the meta value.
  • single, whether code retrieving meta for this key should expect a single or multiple values when using something like get_post_meta().
  • show_in_rest, whether this should be shown as part of a post’s meta endpoint in the WordPress REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/. Note that this should be treated as experimental until the WordPress REST API provides support for meta.

The register_meta_args filterFilter 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. is available to add support for additional arguments. This need to explicitly whitelist further arguments is to reserve the right for core to add further arguments in the future; should you choose to use this filter, you should be prepared to follow along with further development. Your testing with trunktrunk A 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. or betas is greatly appreciated!

By default, only WordPress core object types (post, user, term, comment) can be registered. To add support for custom object types, use the wp_object_types filter. This whitelisting is similar to the above.

Object sub types provide specific registration of meta keys to a type of data.

  • A standard WordPress post has an object type of “post” and an object subtype of “post”.
  • A custom post typeCustom Post Type WordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Custom Post Types gives your site the ability to have templated posts, to simplify the concept. registered with a slug of “my_cpt” has an object type of “post” and an object subtype of “my_cpt”.
  • A WordPress user has an object type of “user” and an object subtype of “user”.
  • A standard WordPress comment has an object type of “comment” and an object subtype of “comment”.
  • A standard WordPress categoryCategory The 'category' taxonomy lets you group posts / content together that share a common bond. Categories are pre-defined and broad ranging. term has an object type of “term” and an object subtype of “category”.
  • A custom taxonomyTaxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies. registered with a slug of “my_tax” has an object type of “term” and an object subtype of “my_tax”.

Meta keys must be explicitly registered for each object type and subtype combination.

Additional helper functions get_registered_metadata(), get_registered_meta_keys(), unregister_meta(), and registered_meta_key_exists() have been added to make the innards of the global data more accessible.

The $wp_meta_keys variable should not be altered directly. It is possible that its structure will change in the future.

Any code currently using register_meta() and expecting pre-4.6 behavior will continue to work as is. Please report any breaks in compatibility that might be found.

Example

Here’s what registering meta looked like in 4.5. This meta key has sanitization and authorization callbacks.

register_meta( 'post', 'my_meta_key', 'sanitize_my_meta_key', 'authorize_my_meta_key' );

The above code will continue to work in 4.6, though will not be considered completely registered. The callbacks will be registered, but the key will not be added to the global registry. A WP_Error object will be returned with this explanation.

Here’s what registering meta looks like in 4.6. This meta key will have sanitization and authorization callbacks, and be registered as public for the WordPress REST API.

$args = array(
    'object_subtype' => 'post',
    'sanitize_callback' => 'sanitize_my_meta_key',
    'auth_callback' => 'authorize_my_meta_key',
    'type' => 'string',
    'description' => 'My registered meta key',
    'single' => true,
    'show_in_rest' => true,
);
register_meta( 'post', 'my_meta_key', $args );

If you are currently using register_meta() and would like to maintain support for older versions of WordPress, the best method will be to check for the registration of the sanitization and authorization callbacks after calling register_meta() and then registering them manually if not present. This manual registration is all that register_meta() was previously doing. Continuing from the example above:

// Pre-WordPress 4.6 compatibility
if ( ! has_filter( 'sanitize_post_meta_my_meta_key' ) ) {
    add_filter( 'sanitize_post_meta_my_meta_key', 'sanitize_my_meta_key', 10, 4 );
}

if ( ! has_filter( 'auth_post_meta_my_meta_key' ) ) {
    add_filter( 'auth_post_meta_my_meta_key', 'authorize_my_meta_key', 10, 6 );
}

What’s next

While the initial work on this is largely driven by the need to move the WordPress REST API forward, its scope is not limited to solving the problem of public access to metadata. By having information about the meta keys used in a code base, it becomes much easier for other pieces of code to make decisions about what can be done with this data.

This data can one day be useful to everything from the CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings., the editing experience for all object types, the Fields APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways., and many plugins that rely on metadata. Work will continue on transforming this $wp_meta_keys object and the methods surrounding it to be flexible and explicit. As WordPress core becomes familiar with register_meta() and more confident in the approach, the set of default arguments can and likely will expand to include more data about registered meta keys as required.

Feedback

Please leave any feedback you have on this new iteration of register_meta() in the comments below. Test it out in your plugins and themes to be sure it is working in a backwards compatible way. Try out the new function signature and register meta for objects and their subtypes. This continues to be a work in progress and feedback is important.

#4-6, #dev-notes, #fields-api, #options-meta, #rest-api

Native Fonts in 4.6

When WordPress switched to Open Sans in version 3.8 at the end of 2013, the state of typography on the web was just beginning to evolve. Before, our choices for typefaces were limited to a small subset of fonts reliably installed on most major operating systems. And, in some cases, those fonts were optimized for print, not the web. Open Sans is optimized for the screen, has generous character support, and, best of all, is open sourceOpen Source Open Source denotes software for which the original source code is made freely available and may be redistributed and modified. Open Source **must be** delivered via a licensing model, see GPL.. For these reasons, it was a better option for a modern web app than the system fonts of that time. Today, the landscape has changed. The majority of our users are now on devices that use great system fonts for their user interface. System fonts load more quickly, have better language support, and make web apps look more like native apps. By using the same font that the user’s device does, WordPress looks more familiar as a result. This change prioritizes consistency from the user’s perspective over consistency in branding. And while typography does play a role in the WordPress brand, the use of color, iconography, and information architecture still feels very much like WordPress. To this end, Font Natively (#36753) replaces Open Sans with a set of system fonts that covers major operating systems, including Android, iOSiOS The operating system used on iPhones and iPads., Windows, macOS, and Linux.

The Font Stack

Safari, Chrome, and Firefox on iOS and macOS have new CSSCSS Cascading Style Sheets. values that return the current system UIUI User interface font, but on other platforms, the font has to be declared by name. As such, the font stack includes the following:
  • -apple-system for Safari (iOS & macOS) and Firefox macOS
  • BlinkMacSystemFont for Chrome macOS
  • Segoe UI for Windows
  • Roboto for Android and Chrome OS
  • Oxygen-Sans for KDE
  • Ubuntu for Ubuntu
  • Cantarell for GNOME
  • Helvetica Neue for versions of macOS prior to 10.11
  • sans-serif, the standard fallback
The complete CSS declaration: font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

Details

The operating system’s UI font is used for any text that’s part of the WordPress user interface. In other contexts, like the Editor, we continue to use a serif system typeface, Georgia. This creates a clear typographic distinction between text that is part of the interface, and text that is part of the user’s content. Not all system fonts provide the same range of weights that Open Sans did. We recommend using only the 400 and 600 weights, which will display most consistently across all platforms. I’ve created a test page that shows the difference between Open Sans and your current device’s system font at every available weight. (A collection of screenshots of that test page is also available). The order in which they’re called is important, because we want the user’s system font to be the first available font in the stack. For example: if Roboto were listed ahead of Segoe UI, Windows developers who have installed the Roboto font for Android development would see it instead of their native system font. There may be edge cases if users have manually installed these fonts on their machines, but this order should work best for the majority of users. When using this font stack, it must be called using the font-family property, and not the font shorthand. This works around an issue in Microsoft Edge.

Screenshots

All screenshots were taken on a retina (2dppx) device. If you’re reviewing screenshots on a non-retina display, check out this Cloudup gallery of 1x screenshots.

#4-6, #design, #dev-notes, #fonts

Dev Chat Summary: July 6th, 2016

WordPress 4.6 BetaBeta A 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. 1 and 2 and the future.

  • Beta 2 was released today. Please test and report bugs on Trac.
  • There will be two more betas and some RCs, each released at 18:00 UTC like beta 2 was.

Dev notesdev note Each 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.

  • Thanks to everyone who published their note today or is still working on it.
  • The published posts can be found here: https://make.wordpress.org/core/tag/4-6+dev-notes/
  • Posts that need to be written can be found here: https://wordpress.slack.com/archives/core/p1467832210003199

Ticketticket Created for both bug reports and feature development on the bug tracker. milestones

For the remaining releases, the number of open tickets should be as follows:

  • Beta 3: 40 tickets
  • Beta 4: 10 tickets
  • RC1: 0 tickets

About page

  • #37246 is the corresponding ticket and the brainstorming document can be found here.
  • @hugobaeta and @karmatosed volunteered to help with design.
  • @jorbin will come up with a rough draft for the content of the page.
  • @joemcgill volunteered to help get responsive images into the page.

Feature project updates

Font Natively

There is currently an issue with the Windows system font. It displays smaller than previously. @helen and @jorbin are working on the best path forward. If further action is needed and you are a Windows user, please help test any patches/commits related to font sizing.

Shiny Updates

  • There are 4 open tickets regard Shiny Updates.
  • There are some issues with the Shiny PluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. Search feature and some discussion and a patchpatch A 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. has been produced, but the design team needs to weigh in as there could be some UXUX User experience/UIUI User interface changes needed.
  • The dev-note for Shiny Updates will be published shortly after dev chat.
  • Shiny Updates V3 has kicked off, with the main focus being on update-core.php.

Component announcements/updates and Open discussion

@spacedmonkey brought up #37189, but it is considered an enhancementenhancement Enhancements are simple improvements to WordPress, such as the addition of a hook, a new feature, or an improvement to an existing feature. and the enhancement window has closed for 4.6.

The full meeting logs can be found here: https://wordpress.slack.com/archives/core/p1467835204003205

#4-6, #dev-chat, #summary

Multisite Office Hours Recap (July 5, 2016)

Multisitemultisite Used 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 office hours are held every Tuesday at 16:00 UTC in #core-multisite. The next will be Tuesday 16:00 UTC. A more casual bugbug A 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. scrub is on Thursday 20:00 UTC.

The weekly agenda for the 4.6 cycle is to (a) address blockers and share status on bigger initiatives, then (b) walk through a few multisite focused tickets on TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress..

Today’s chat log

Attendees: @spacedmonkey, @ocean90, @paaljoachim, @richardtape, @flixos90

Tickets Covered

  • #20537 seems possible, but needs an updated patchpatch A 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.. @jrf left a note after office hours that she is going to work on it Friday.
  • #26855 is likely to be punted due to a lack of recent activity. However, @spacedmonkey would like to work on a patch there, so there is still a chance this could land.
  • #18088 has an updated patch by @flixos90 which needs some testing. @spacedmonkey will try to review it.
  • #35379 still lacks a decision which approach to take. Considering there might possibly be major changes in handling networknetwork (versus site, blog) options coming up (see #37181), more time is required to think about the best way to tackle this bug. The ticketticket Created for both bug reports and feature development on the bug tracker. got punted to a future release.
  • #37223 is a rather straightforward fix, but will need an updated patch. @flixos90 is going to leave a comment there to ask the author of the patch for an update.
  • #36954 is being reviewed by @jeremyfelt and is likely to be merged.
  • #37102 will, although being a straightforward change, not make it into 4.6 as the first betaBeta A 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. has already been released. Furthermore the function get_blog_details() has not been deprecated yet, so the ticket is not necessary to complete at this point.

Other Notes

  • The 4.6 dev notedev note Each 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. for the Networks & Sites component should get ready on Wednesday. A Google doc will be used for collaboration.

If you aren’t available during the weekly multisite office hours, feel free to leave a comment here or in #core-multisite with a ticket number you’d like to see discussed.

See you next week!

#4-6, #multisite, #network-sites