Week in Core, August 16 – 23, 2016

Welcome back the latest issue of Week in Core, covering changes [38274-38345]. Here are the highlights:

  • 72 commits
  • 40 contributors
  • 100 tickets created
  • 9 tickets reopened
  • 96 tickets closed

Ticket numbers based on trac timeline for the period above. The following is a summary of commits, organized by component.

Code Changes


  • Allow for .nav-tab-wrapper class to be used on elements other than h3 to increase flexibility for custom settings pages. [38306] #37257


  • add a new function, wp_doing_ajax(), which can replace… (wait for it…) DOING_AJAX checks via the constant. [38334] #25669



  • in WP_Object_Cache, $cache_misses is public, but $cache_hits is private. They should both be public, because they’re useful for debugging purposes. [38335] #37726


  • in wp_handle_comment_submission(), $_wp_unfiltered_html_comment is passed as part of $comment_data, but is not used locally. [38313] #37771
  • in WP_Comment_Query::fill_descendants(), continue if there is an empty array in the loop. [38298] #37416
  • in WP_Comment_Query::fill_descendants(), compute count() in the first for expression so that it does not run on each iteration. [38297] #37416


  • Ensure a newly-added custom link nav menu item has the appropriate CSS class names. [38301] #37575


  • WP_Network, WP_Network_Query, and WP_Site_Query call wpdb::_escape(), thus requiring it to be public. It previously had no access modifier. _ at the beginning of a method, believe it or not, does not enforce visibility constraints. [38314] #37771


  • Update jsdoc in customize-nav-menus.js to remove references to Menu Customizer plugin. Also fix @param for updateAssignedLocationsInSectionTitle. [38300] #37520
  • Update outdated phpdoc for WP_Customize_Manager::validate_setting_values() to reflect changes in [37942]. [38299] #37247, #37759
  • Correct usage examples for wpdb::prepare(), which should not be called statically. [38289] #37744
  • Fix typo in load_plugin_textdomain() parameter description. [38284] #37318


  • In get_oembed_endpoint_url(), avoid inadvertent stomping of the $format parameter passed to oembed_endpoint_url filter. [38321] #37751

External Libraries


  • remove variable set needlessly in wp_check_jsonp_callback(). [38308] #37771


  • Standardize naming of dynamic hooks to use interpolation vs concatenation. [38307] #37748


  • in WP_HTTP_Response, the @param declarations for $status and $headers were swapped. Let us correct this. [38315] #37771


  • Add translator comments for strings in wp-includes/functions.wp-scripts.php. [38345] #37803
  • Add translator comments for strings in wp-includes/functions.php. [38344] #37802
  • Add translator comments for strings in wp-includes/deprecated.php. [38343] #37797
  • Add translator comments for strings in wp-includes/class-walker-comment.php. [38342] #37796
  • Add translator comments for strings in wp-includes/author-template.php. [38341] #37795
  • Add translator comments for strings in wp-includes/admin-bar.php. [38340] #37794
  • Remove unnecessary context for two strings on “Add New User” screen. [38329] #37784
  • Remove unnecessary context in wp_post_revision_title_expanded(). [38327] #37781
  • Use a consistent context for “Add New” submenu strings in admin bar (Toolbar). [38326] #37780
  • Allow for WordPress Plugin/Theme Directory URLs to be localized. [38325] #37501
  • Replace unnecessary context with translator comments in wp_post_revision_title() and wp_post_revision_title_expanded(). [38324] #37778
  • Replace unnecessary context with a translator comment for %s Sites string in network_step1(). [38323] #37777
  • Replace unnecessary context with a translator comment for %s KB string on Network Settings screen. [38322] #37496
  • Add translator comments for Edit Site: %s string in network admin. [38320] #37776



  • retrieve_password() does not need to import 2 globals that it does not use. [38304] #37699


  • If post-by-email functionality is disabled, wp-mail.php should return a 403 Forbidden status code instead if 500 Internal Server Error. [38332] #37572
  • Don’t set Sender field when setting From. Merges [38286] to the 4.6 branch. [38287] #37736
  • Don’t set Sender field when setting From. [38286] #37736


  • remove function_exists() call for ini_get() in _load_image_to_edit_path(). [38333] #37681
  • remove unnecessary variable assignment in gallery_shortcode(). [38309] #37771
  • add a function, wp_get_additional_image_sizes(), that wraps the retrieval of the global $_wp_additional_image_sizes. Removes 6 global imports. [38303] #37699
  • fix unit test after [38296].
  • use wp_get_attachment_metadata() instead of get_post_meta() where appropriate. [38296] #36246
  • wp_get_attachment_link() fails to output text for non-images if the attachment post doesn’t have a title and $text (argument #5) was not passed to the func. In this case, use the filename. [38295] #5, #37343
  • when calling pathinfo(), also pass a PATHINFO_* constant to avoid array notices for unset keys. [38294] #37608
  • Add some docs to media-gallery.js RIP. [38293] #37717


  • Fix copy/paste issue in id attribute for a dismissible message on Sites screen. [38305] #37764

Nav Menus

  • remove unnecessary variable assignment in wp_nav_menu_item_post_type_meta_box(). [38311] #37771


  • use correct description in the docblock for $number in WP_Comment_Query, WP_Network_Query, and WP_Site_Query. [38336] #37621
  • Non-scalar and negative values for ‘p’ should always result in a 404. [38288] #33372
  • use composition for $db in WP_Date_Query, removes need to import global $wpdb in multiple methods. [38280] #37699
  • use composition for $db in WP_Query, removes need to import global $wpdb in multiple methods. [38279] #37699
  • add a protected field, $db, (composition, as it were) to WP_*_Query classes to hold the value for the database abstraction, instead of importing the global $wpdb into every method that uses it. Reduces the number of global imports by 32. [38275] #37699


  • remove unnecessary variable assignments in rest_handle_options_request(). [38310] #37771


  • in get_terms(), do not assume that legacy args are being passed when the only params are top-level meta_* values. Add keys in WP_Term_Query::__construct(). Adds unit tests. [38337] #37568
  • remove unnecessary break in WP_Term::__get(). [38312] #37771
  • In is_object_in_term(), return error object rather than caching it. [38277] #32044, #36814, #37721
  • Allow attachment taxonomies to be fetched as objects. [38292] #37368


  • Fix incorrect variable name from [38330]. [38331] #37630
  • Attachment create() method should match signature of other create() methods. Legacy argument format continues to be accepted. [38330] #37630
  • Move some utility classes to their own files. [38285] #37523
  • skip checking the value in Tests_User:test_user_properties for db. Casting to array is not the most elegant thing here, and various versions of PHP key protected/private fields differently when objects are cast. [38278] #37699
  • Introduce tests for get_attachment_taxonomies(). [38291] #37368
  • Introduce tests for get_object_taxonomies(). [38290] #37368
  • Add wordpress-importer tests demonstrating slashed data behavior. [38283] #21007


  • make sure the temporary id is removed when using the default image dialog and inserting an external image. [38328] #37467


  • after [38317], use a @property annotation, instead of a public field. [38319] #37771
  • $user_level has been publicly-accessed on instances of WP_User since version 2.0, but is has never been declared. [38317] #37771


  • $option_name and $alt_option_name have been used as members ever since WP_Widget became an object in 2.8, but never declared. [38318] #37771


Thanks to @afercia, @Akeif, @azaozz, @bcole808, @boonebgorges, @Clorith, @codemovementpk, @danhgilmore, @danielbachhuber, @dd32, @deremohan, @dlh, @DrewAPicture, @flixos90, @fomenkoandrey, @Frank, @gma992, @henrywright, @iandunn, @imath, @JaworskiMatt, @jipmoors, @Jonnyauk, @jorbin, @JorritSchippers, @Klein, @kouratoras, @Mte90, @Presskopp, @ramiy, @rpayne7264, @sebastianpisula, @SergeyBiryukov, @swissspidy, @tivnet, @TJNowell, @tomdxw, @vishalkakadiya, @westonruter, and @wonderboymusic for their contributions!

#4-6, #week-in-core