WordPress Core Weekly – Aug. 24-30, 2015

Welcome back to the weekly coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. development recap post, with highlights from TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. changesets and other development updates for 4.4. This week’s update covers changesets [33721][33820], Aug. 24-30, 2015. That’s a lot of changes, but there are a few that developers need to be especially aware of:

  • File restructuring: new class and functions files have been introduced, and existing files used as loaders for the new files for backwards compatibility.
  • File and class documentation enhancements: ensuring every file gets a standard file headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes., even if that file only contains a class that is itself documented.
  • Switching themes now takes menu locations into account so the new theme (maybe) gets the locations of the current theme.
  • New 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. introduced: 'invite_user' (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 users) and 'wp_verify_nonce_failed'.
  • The Twenty Sixteen theme is being developed on GitHub.

Now on to the firehose…

Administration

  • Bump h3 headings to h2 on various adminadmin (and super admin) screens for better accessibilityAccessibility Accessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both “direct access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility):
  • Networknetwork (versus site, blog) Admin: Hide the bulk actions checkbox for super admins. [33777] #28529
  • Avoid PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher notices in redirect_canonical() and _wp_menu_item_classes_by_context() if $_SERVER['HTTP_HOST'] is not set. [33775] #32229

General

  • Remove error from the query variables when cleaning up a URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org in wp_admin_canonical_url(). [33770] #32847
  • Prevent unintended password change after clicking “Generate Password” and then “Cancel” when editing a user profile. [33766] #33419
  • When wp_json_encode() calls json_encode(), the latter will generate warnings if the string contains non-UTF-8 characters. No one likes warnings, so we need to do something about that. [33747] #33524
  • Add oEmbed support for ReverbNation. [33745] #33207
  • Remove rounded corners from “Choose from the most used tags” result in Tags 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. [33742] #31560
  • Add some more data for shortcodeShortcode A shortcode is a placeholder used within a WordPress post, page, or widget to insert a form or function generated by a plugin in a specific location on your site. unit tests. [33740] #33455
  • Allow these CSSCSS Cascading Style Sheets. properties in KSES: min-height', 'max-height', 'min-width', 'max-width' [33739] #31949
  • Pass option name to option and transient filters with dynamic names. [33738] #28402
  • In get_home_url(), import the $pagenow global to avoid having to check if it exists before comparing against it. [33736] #33545
  • In WP_Users_List_Table::single_row(), $actions is not always set before being used. [33735] #33491
  • foreach is a statement, not a function. [33734] #33491
  • Instead of [33713], allow WP_Posts_List_Table::get_bulk_actions() to check edit_posts AND delete_posts. [33733] #29789
  • TinyMCE: ensure the wordpress 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 is loaded before calling _createToolbar(). [33728] #33393
  • With a few modifications in wp-admin/menu.php, we can eliminate the extra logic for Post and Page menu registration. Instead, they can just declare menu_position on post type registration. [33723] #16865
  • WP_Query: add changelog for the title param after [33706] [33722] #33074

Restructured some files for separation of purpose, so class files only contain classes, functions files only contain functions, and the existing file loads the new files for backwards compatibility.

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.

Move WP_Tax_Query into class-wp-tax-query.php and functions into taxonomy-functions.php; taxonomy.php contains only top-level code and loads the new files. [33760] #33413

Posts

Move WP_Post into class-wp-post.php and functions into post-functions.php. post.php contains only top-level code and loads the new files. [33759] #33413

Roles

Move classes into their own files, and functions into its own:

  • class-wp-roles.php
  • class-wp-role.php
  • class-wp-user.php
  • capbilities-functions.php

capbilities.php contains only top-level code and loads the new files. [33752] #33413

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.

Move classes into their own files and functions into its own:

  • class-wp-http-cookie.php
  • class-wp-http-curl.php
  • class-wp-http-encoding.php
  • class-wp-http-proxy.php
  • class-wp-http-streams.php
  • http-functions.php

http.php contains only top-level code and loads the new files, so this is 100% BC if someone is loading http.php directly.

class-http.php requires functions from http.php, so loading it by itself wouldn’t have worked.

WP_Http remains in class-http.php. [33748] #33413

Meta

Move WP_Meta_Query into class-wp-meta-query.php and functions into meta-functions.php. meta.php contains only top-level code and loads the new files. [33761] #33413

Rewrite

Move WP_Rewrite into class-wp-rewrite.php, functions into rewrite-functions.php, and constants into rewrite-constants.php. rewrite.php contains only top-level code and loads the new files.

The rewrite functions have all kinds of cross-dependencies (like WP_Query), so loading the file by itself would have been bizarre (and still is). [33751] #33413

Comments

Move WP_Comment_Query into class-wp-comment-query.php, and functions into comment-functions.php. comment.php contains only top-level code and loads the new files. [33750] #33413

Users

Move WP_User_Query into class-wp-user-query.php and functions into user-functions.php. user.php contains only top-level code and loads the new files. [33749] #33413

Widgets

Move classes and functions into their own files:

  • class-wp-widget.php
  • class-wp-widget-factory.php
  • widget-functions.php

widgets.php contains only top-level code and loads the new files. [33746] #33413

Docs

It’s important for every file in WordPress, regardless of makeup or architecture, to have its own file header, even if the file contains nothing but a class. When parsed, files and classes are mutually exclusive and should be documented with this in mind. [33755] [33756] #33413

  • Bring the file header and class DocBlockdocblock (phpdoc, xref, inline docs) summaries for class-wp-widget.php in-line with the intention of the docs standard:
    • File headers: What the file is
    • Class DocBlocks: What purpose the class serves. Mentioning the class name in the class DocBlock is redundant [33816] #33413
  • Add inline-docblocks for the require_once() calls that now bring in the WP_Widget and WP_Widget_Factory classes, as well as general core widgets functionality, as of [33746]. [33758] #33413
  • Add a file header description and @since version to wp-includes/widget-functions.php, introduced in [33746].
    Also adds sub-section headers per the inline documentation standards for syntax. [33757] #33413
  • Add a file header to wp-includes/class-wp-widget-factory.php, created when the WP_Widget_Factory class was moved to its own file in [33746]. [33756] #33413
  • Correct the hook docs for the user_profile_update_errors action. [33769] #33537
  • After [33764], fix docblock formatting for wp_list_categories(). [33765] #33460
  • Use proper array documentation formatting for wp_list_categories().
    This changeset also corrects a few parameter descriptions, and adds a few that
    were previously missing. [33763] #33556
  • Fix copy pasta in wp_cache_decr() doc blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience.. [33809] #33548
  • The type for the $t_time parameter in the post_date_column_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. docs should be string, not array. [33731] #33540
  • Document the default comment data arguments for wp_new_comment(). [33730] #32369
  • After [33698], wrap the time constants in a DocBlock template. [33737] #33397
  • Clarify the return description for wp_create_user() to illustrate that a WP_Error object will be returned on failure. [33725] #33321

Add changelog entries for a variety of hook doc parameters added in [33738]:

hook parameter changeset/ticketticket Created for both bug reports and feature development on the bug tracker.
set_site_transient_$transient $transient [33794] #28402
site_transient_$transient $transient [33792] #28402
pre_delete_site_option_$option $option [33789] #28402
pre_add_site_option_$option $option [33788] #28402
pre_site_option_$option $option [33785] #28402
transient_$transient $transient [33783] #28402
option_$option $option [33779] #28402
pre_option_$option $option [33768] #28402
pre_set_site_transient_$transient $transient [33793] #28402
pre_site_transient_$transient $transient [33791] #28402
pre_update_site_option_$option $option [33790] #28402
site_option_$option $option [33787] #28402
default_site_option_$option $option [33786] #28402
pre_set_transient_$transient $transient [33784] #28402
pre_transient_$transient $transient [33782] #28402
update_option_{$option} $option [33781] #28402
pre_update_option_$option $option [33780] #28402
default_option_$option $option [33778] #28402

Themes

  • Get the correct theme when template and stylesheet were both passed as arguments. Fixes a 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. introduced in [21131] where $new_theme got set before the second argument was
    appropriately handled, causing the current_theme option to later always be updated to the parent theme’s name. [33815] #32635

Widgets

  • Improve/update escaping in default widgets:
    • wrap some variables in esc_attr() before echoing
    • replace some strip_tags() calls with sanitize_text_field()
    • call esc_url() when wrapping some URLs [33814] #23012
  • Improve/update escaping in WP_Widget_Pages. [33813] #23012
  • Switch back to using array_key_exists() instead of isset() for widgetWidget A WordPress Widget is a small block that performs a specific function. You can add these widgets in sidebars also known as widget-ready areas on your web page. WordPress widgets were originally created to provide a simple and easy-to-use way of giving design and structure control of the WordPress theme to the user. instance existence check.
    Reverts unnecessary change in [32602] since array_key_exists() does actually work with ArrayIterator objects.
    Merges [33696] to the 4.3 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".. [33721] #32474, #33442

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.

  • Add some theme mod unit tests. [33812] #28637
  • Prevent JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. error during init when nav_menus panel is removed by plugin. [33753] #33411
  • Ensure persistence of unchanged active state for controls, sections, and panels. [33754] #33428, #33494
  • Use existing decoupled strings in Menu Locations section. See [31941] and [31951]. [33741] #33416

Comments

  • Fix the doc block syntax for the 'wp_get_current_commenter' filter. [33811] #33304
  • get_comment_count() currently increments awaiting_moderation when comments are in the trashTrash Trash in WordPress is like the Recycle Bin on your PC or Trash in your Macintosh computer. Users with the proper permission level (administrators and editors) have the ability to delete a post, page, and/or comments. When you delete the item, it is moved to the trash folder where it will remain for 30 days.. This occurs because case 0: will match any value passed to switch that is a string that isn’t specified in the list of cases. This is terrifying.
    Cases for 0 and 1 should be '1' and '0'
    Add unit tests for get_comment_count(). Currently, there are none. [33806] #33414

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.

  • Favor using the consistent and agnostic string ‘Attach’ over ‘Attach to a post’ in the media list table. [33810] #33515
  • Make a period translatable. [33802] #33594
  • Switching themes: if the new theme doesn’t have nav_menu_locations defined, but the old theme does, copy the old theme’s nav_menu_locations into the new theme’s theme mods. [33808] #18588

Media

  • Improve the reliability of the crop returned by image_get_intermediate_size() and add a bunch of unit tests to tests/image/intermediate_size.php. [33807] #17626
  • When inserting an image into a post, the values in wp.media.controller.Library should not default to linking the image when no user settings are present.
    The default display setting value for link is now none. User settings persist and will override or confirm this value based on user actions. [33729] #31467

Posts, Post Types

  • In get_post_type_labels(), ensure that filtered labels contain all required default values. [33776] #33543
  • Don’t change the View Post button permalink in the sample permalink HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. when updating the slug on a published or future post. [33773] #32954
  • Pass taxonomy name to filters in get_adjacent_post(). [33805] #33568
  • Make post meta box toggles accessible. [33762] #33544

Multisite

  • Improve the efficiency of is_user_member_of_blog() by removing its use of get_blogs_of_user(). Adds additional tests. [33771] #32472
  • Add 'invite_user' action that fires immediately after a user is invited to join a site, but before the notification is sent. [33732] #33008

Taxonomy

  • In wp_list_categories(), ‘current_category’ should accept an array of values. [33804] #33565
  • Introduce $hide_title_if_no_cats parameter to wp_list_categories(). [33764] #33460
  • Rename param added to wp_list_categories() in [33764] to $hide_title_if_empty. [33767] #33565
  • Term Splitting: Switch to a faster cron unschedule process to benefit sites with thousands of affected jobs. Fix the cron hook name in the failsafe rescheduler. [33727] #33423
  • In WP_Query::parse_tax_query(), allow ‘cat’ and ‘tagtag A directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.)’ querystrings to be formatted as arrays. [33724] #32454, #33532

Date/Time

  • Simplify the weeks-per-year calculation WP_Date_Query::validate_date_values(). [33803] #30845

Users

  • Bring network admin user searching to parity with single site user searching by wrapping search terms in asterisks. This means that searches don’t require an exact match and therefore significantly reduces friction when searching for users on the network admin screens. [33801] #32913

Bundled Theme

Correct license information in readme.txt.

Text Changes

  • Drop the hyphen from e-mail and standardize on email.
    The AP Stylebook changed this in 2011, and we’re woefully inconsistent, so let’s go with the standard. [33774] #26156

Upgrade/Install

Security

  • Add 'wp_verify_nonce_failed' action that fires when nonce verification fails. [33744] #24030
  • Fire the check_ajax_referer action on failure as well as success. [33743] #33342

Build Tools

Thanks to @azaozz, @BinaryKitten, @boonebgorges, @bordoni, @Cheffheid, @chipbennett, @danielbachhuber, @dd32, @DeBAAT, @dimadin, @DrewAPicture, @ebinnion, @egill, @eherman24, @ericlewis, @garza, @hauvong, @helen, @janhenckens, @jjeato, @jmayha, @joedolson, @joehills, @joemcgill, @johnbillion, @KalenJohnson, @kitchin, @liljimmi, @luciole135, @mako09, @MikeHansenMe, @miqrogroove, @morganestes, @niallkennedy, @nikeo, @obenland, @Otto42, @pavelevap, @pento, @peterwilsoncc, @rachelbaker, @rhubbardreverb, @sammybeats, @sboisvert, @scribu, @SergeyBiryukov, @Shelob9, @tyxla, @Veraxus, @vilkatis, @Viper007Bond, @voldemortensen, @welcher, @westonruter, @wonderboymusic, and @yamchhetr for their contributions!

#4-4, #week-in-core