Title: 4.5 – Make WordPress Core

---

#  Tag Archives: 4.5

 [  ](https://profiles.wordpress.org/jorbin/) [Aaron Jorbin](https://profiles.wordpress.org/jorbin/)
8:52 pm _on_ March 30, 2016     
Tags: 4.5, [dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/),
[field guide ( 35 )](https://make.wordpress.org/core/tag/field-guide/)   

# 󠀁[WordPress 4.5 Field Guide](https://make.wordpress.org/core/2016/03/30/wordpress-4-5-field-guide/)󠁿

WordPress 4.5 is the next major version of WordPress and with it come some bang 
bang changes. This guide will describe many of the developer-focused changes to 
help you test your themes, plugins, and sites. So grab a ☕️ ,🍷,🍵, or 🍺 and get
ready for what’s coming soon.

### 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](https://www.javascript.com/)󠁿! and CSSCSS Cascading Style Sheets.!

Multiple external libraries have been updated with the two that require your attention
being [Backbone and Underscore](https://make.wordpress.org/core/2016/02/17/backbone-and-underscore-updated-to-latest-versions/).
There were some**‼️ ****breaking changes **‼️ with these two libraries, so make 
sure to test your code if you use either of these. [ jQuery and jQuery Migrate have also been updated](https://make.wordpress.org/core/2016/03/29/jquery-updates-in-wordpress-4-5/),
please test with the unminified versions in order to ensure future compatibility
with WordPress.

[The script loader has been updated](https://make.wordpress.org/core/2016/03/08/enhanced-script-loader-in-wordpress-4-5/)
with three big changes. The build process no longer creates `wp-admin.min.css`, `
wp_add_inline_script()` joins the family of functions, and better support for multigenerational
dependencies is included.

### Term Edit Page! –**‼️** Backward Incompatible change‼️

[The term edit screen has been separated out from the term list screen](https://make.wordpress.org/core/2016/03/07/changes-to-the-term-edit-page-in-wordpress-4-5/).
This brings greater consistency to how the adminadmin (and super admin) generates
screens for terms and posts but at the cost of the need to change how you register
scripts and how you detect that you are on a term edit screen.

### Live Preview: Faster, ExtensibleExtensible This is the ability to add additional functionality to the code. Plugins extend the WordPress core software., More Features!

Live Preview (also known as “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.”) once again has received attention this release
with the addition of new controls, some performance improvements that require your
attention to implement, and a two new user-facing features.

[Setting-less Controls, Device Previews, and Selective Refresh](https://make.wordpress.org/core/2016/03/10/customizer-improvements-in-4-5/)
are the three biggest changes you’ll find. Setting-less controls make it easier 
for you to implement complex interfaces. [Device Preview](https://make.wordpress.org/core/2016/01/28/previewing-site-responsiveness-in-the-customizer/)
is a user facing feature that allows users to adjust the preview to match the screens
on various devices.  This feature includes filters to change the devices users can
choose. [Selective Refresh](https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/)
allows for changes to appear quicker inside the preview, and you can do so with 
less code than before. **Theme authors need to make changes to take advantage of
selective refresh**. Luckily, the change will generally result in fewer lines of
codeLines of Code Lines of code. This is sometimes used as a poor metric for developer
productivity, but can also have other uses. needed overall ( more 🍎 than 🍏 ).

One area that selective refresh helps live preview function faster is with widgets.

**‼️ If you offer sidebars or a 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. in your theme or 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/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party.**, please update your code to [implement selective refresh](https://make.wordpress.org/core/2016/03/22/implementing-selective-refresh-support-for-widgets/).
Both themes and widgets need to indicate support, so please update your code accordingly.

The final change to Live Preview involves a control for a new theme feature, and
that is Custom Theme Logos.

### Custom Theme Logos!

Themes can now offer support for custom logos. Custom Logos add an additional way
for users to customize their site and [theme developers can customize how custom logos are displayed](https://make.wordpress.org/core/2016/03/10/custom-logo/).

### Image Performance!

Following up on the introduction of responsive images in WordPress 4.4, WordPress
4.5 is making changes to [improve image performance](https://make.wordpress.org/core/2016/03/12/performance-improvements-for-images-in-wordpress-4-5/)
including improved compression settings and smarter handling of image metadata.

### Embed Templates! (and other iterations)

Iterating on embeds has led to the ability to better customize embeds by adding 
[new templates to the template hierarchy for embeds](https://make.wordpress.org/core/2016/03/11/embeds-changes-in-wordpress-4-5/).
Embeds have also had some performance improvements for autodiscovery, the ability
to embed the front page of a site, and changes to the iframeiframe iFrame is an 
acronym for an inline frame. An iFrame is used inside a webpage to load another 
HTML document and render it. This HTML document may also contain JavaScript and/
or CSS which is loaded at the time when iframe tag is parsed by the user’s browser.
of embedded content.

### Comments Component!

The [comments component](https://make.wordpress.org/core/2016/03/09/comment-changes-in-wordpress-4-5/)
has a few user-facing changes to make comments easier to moderate. For developers,
the most notable change is the ability to adjust field lengths for your custom database
schema. Additionally, the `rel=nofollow` attribute and value pair will no longer
be added to relative or same domain links within `comment_content`.

### 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**!

[Multisite](https://make.wordpress.org/core/2016/03/09/multisite-focused-changes-in-4-5/)
once again has seen changes with the addition of new filters around site and user
creation, and a `WP_Site` object.

### And more!

Overall, [372 bugs](https://core.trac.wordpress.org/query?status=accepted&status=assigned&status=closed&status=new&status=reopened&status=reviewing&type=defect+(bug)&resolution=fixed&milestone=4.5&col=id&col=summary&col=milestone&col=status&col=type&col=owner&col=priority&order=priority)
have been marked as fixed in WordPress 4.5 (so far). There are also dozens of 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. and dozens of hooks that have
received additional parameters. It’s entirely possible that one or more has caused
a regressionregression A software bug that breaks or degrades something that previously
worked. Regressions are often treated as critical bugs or [blockers](https://make.wordpress.org/core/tag/4-5+dev-notes/?output_format=md#blocker).
Recent regressions may be given higher priorities. A "3.6 regression" would be a
bug in 3.6 that worked as intended in 3.5., so please make sure to test your code
deeply and [report any issues you find](https://core.trac.wordpress.org/newticket).

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#field-guide](https://make.wordpress.org/core/tag/field-guide/)

 [  ](https://profiles.wordpress.org/ocean90/) [Dominik Schilling](https://profiles.wordpress.org/ocean90/)
4:50 pm _on_ March 29, 2016     
Tags: 4.5, [dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/),
[external libraries ( 7 )](https://make.wordpress.org/core/tag/external-libraries/)

# 󠀁[jQuery Updates in WordPress 4.5](https://make.wordpress.org/core/2016/03/29/jquery-updates-in-wordpress-4-5/)󠁿

**jQuery** was updated from version 1.11.3 to **1.12.2**, see [[36285]](https://core.trac.wordpress.org/changeset/36285),
[[36680]](https://core.trac.wordpress.org/changeset/36680), and [[37070]](https://core.trac.wordpress.org/changeset/37070).

At the same time **jQuery Migrate** – the 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/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. to detect and restore APIs or features
that have been deprecated in jQuery – was updated from 1.2.1 to **1.4.0** ([[36285]](https://core.trac.wordpress.org/changeset/36285)
and [[37072]](https://core.trac.wordpress.org/changeset/37072)).

The non-minified version of jQuery Migrate throws a few more [warnings](https://github.com/jquery/jquery-migrate/blob/1.4.0/warnings.md)
now. See some examples from coreCore Core is the set of software required to run
WordPress. The Core Development Team builds WordPress. in [[36286-36288]](https://core.trac.wordpress.org/log/?revs=36286-36288).

🔬 Please test your plugins and themes [with the non-minified version](https://codex.wordpress.org/Debugging_in_WordPress#SCRIPT_DEBUG)
to make them compatible with future versions of jQuery.

Ticketticket Created for both bug reports and feature development on the bug tracker.:
[#35380](https://core.trac.wordpress.org/ticket/35380)

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#external-libraries](https://make.wordpress.org/core/tag/external-libraries/)

 [  ](https://profiles.wordpress.org/ellatrix/) [Ella Van Durpe](https://profiles.wordpress.org/ellatrix/)
8:41 pm _on_ March 28, 2016     
Tags: 4.5, [dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/),
[editor ( 223 )](https://make.wordpress.org/core/tag/editor/)   

# 󠀁[The Editor in WordPress 4.5](https://make.wordpress.org/core/2016/03/28/the-editor-in-wordpress-4-5/)󠁿

## Inline Link Toolbar

From WordPress 4.5 you will be able to link text with an inline toolbar, which replaces
the link modal. You will still be able to access the modal with the gear icon in
the toolbar, if you’re using one of the advanced fields or are 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/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. that extends the modal. Eventually
we will try to move all those fields inline, though still under an advanced toggle
and not visible by default. For those interested, see [#36312](https://core.trac.wordpress.org/ticket/36312).

![Inline link toolbar.](https://make.wordpress.org/core/files/2016/03/wordpress-
inline-link-toolbar.png)

## Text Patterns

We also added some more text patterns, or shortcuts if you like: `\`text\`` will
change to `<code>text</code>` and `---` (or more dashes) will change to `<hr>` while
typing. We considered adding patterns for bold and italic, but there was no consensus
yet and we’d like to test the inline text patterns first on an HTMLHTML HyperText
Markup Language. The semantic scripting language primarily used for outputting content
in web browsers. 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.) mostly used by 
developers. See [#33301](https://core.trac.wordpress.org/ticket/33301).

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#editor](https://make.wordpress.org/core/tag/editor/)

 [  ](https://profiles.wordpress.org/westonruter/) [Weston Ruter](https://profiles.wordpress.org/westonruter/)
12:50 am _on_ March 22, 2016     
Tags: 4.5, [customize ( 67 )](https://make.wordpress.org/core/tag/customize/),
[dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/), [feature-selective-refresh ( 4 )](https://make.wordpress.org/core/tag/feature-selective-refresh/)

# 󠀁[Implementing Selective Refresh Support for Widgets](https://make.wordpress.org/core/2016/03/22/implementing-selective-refresh-support-for-widgets/)󠁿

WordPress 4.5 includes a new 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. framework called [selective refresh](https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/).
To recap, selective refresh is a hybrid preview mechanism that has the performance
benefit of not having to refresh the entire preview window. This was previously 
available with JSJS JavaScript, a web scripting language typically executed in the
browser. Often used for advanced user interfaces and behaviors.-applied `postMessage`
previews, but selective refresh also improves the accuracy of the previewed change
while reducing the amount of code you have to write; it also just makes possible
to do performant previews that would previously been practically impossible. For
example, themes often include some variation of the following PHPPHP The web scripting
language in which WordPress is primarily architected. WordPress requires PHP 7.4
or higher and 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](https://www.javascript.com/)
to enable performant previewing of changes to the site title:

    ```notranslate
    function mytheme_customize_register( WP_Customize_Manager $wp_customize ) {
    	$wp_customize->get_option( 'blogname' )->transport = 'postMessage';
    }
    add_action( 'customize_register', 'mytheme_customize_register' );

    function mytheme_customize_preview_js() {
    	$handle = 'mytheme-customize-preview';
    	$src = get_template_directory_uri() . '/js/customize-preview.js';
    	$deps = array( 'customize-preview' );
    	$ver = '0.1';
    	$in_footer = true;
    	wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
    }
    add_action( 'customize_preview_init', 'mytheme_customize_preview_js' );
    ```

    ```notranslate
    ( function( $, api ) {
    	api( 'blogname', function( setting ) {
    		setting.bind( function( value ) {
    			$( '.site-title a' ).text( value );
    		} );
    	} );
    } ( jQuery, wp.customize ) );
    ```

In 4.5, the coreCore Core is the set of software required to run WordPress. The 
Core Development Team builds WordPress. themes now utilize selective refresh for
previewing the site title and tagline. This allows the above code to be replaced
with the following PHP:

    ```notranslate
    function mytheme_customize_register( WP_Customize_Manager $wp_customize ) {
    	$wp_customize->selective_refresh->add_partial( 'blogname', array(
    		'selector' => '.site-title a',
    		'render_callback' => function() {
    			bloginfo( 'name' );
    		},
    	) );
    }
    add_action( 'customize_register', 'mytheme_customize_register' );
    ```

So as you can see, not only is the amount of code more than cut in half (also eliminating
the JS file altogether), it also ensures that when a site title change is previewed
it will appear with all of the PHP filters applied from core and plugins: for example`
wptexturize` will apply so that curly quotes and dashes will appear as expected.
In 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/](https://developer.wordpress.org/rest-api/)
parlance, selective refresh enables the Customizer preview to show `title.rendered`
instead of just `title.raw`. (For more on this change to previewing the site title
and tagline, see [#33738](https://core.trac.wordpress.org/ticket/33738). The previous
JS-based previewing is retained for an instant low-fidelity preview while the selective
refresh request returns.) Selective refresh is also the mechanism used for previewing
the new custom logo feature in 4.5, ensuring that the logo image is rendered re-
using the `image_downsize` logic in PHP without having to re-implement it in JS (
keeping the code DRY).

With that recap of selective refresh out of the way, let’s turn to the focus of 
this post: **selective refresh for widgets**. When 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. management was added to the
Customizer in 3.9, every change to a widget required a full page refresh to preview.
This resulted in a poor user experience since a full refresh can take awhile, especially
on weighty pages. So selective refresh of widgets is a key usability experience 
improvement for widget management in the Customizer in 4.5. However, as live `postMessage`
updates to the site title and tagline have required supporting theme code (see above),
so too will theme support be required for widgets, as noted in the [Selective Refresh of Widgets](https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/#selective-refresh-of-widgets)
section from the previous post on this topic:

> Selective refresh for nav menus was enabled by default in 4.3. While some themes
> needed to add [theme support](https://make.wordpress.org/core/2015/07/29/fast-previewing-changes-to-menus-in-the-customizer/)
> for any dynamic aspects (such as the expanding submenus in Twenty Fifteen), generally
> nav menus seem to be fairly static and can be replaced in the document without
> needing any JS logic to be re-applied. Widgets, on the other hand, have much more
> variation in what they can display, since they can in fact display anything. For
> any widget that uses JavaScript to initialize some dynamic elements, such as a
> map or gallery slideshow, simply replacing the widget’s content with new content
> from the server will not work since the dynamic elements will not be re-initialized.
> Additionally, the sidebars (widget areas) in which the widgets are displayed may
> also have dynamic aspects associated with them, such as the Twenty Thirteen sidebarSidebar
> A sidebar in WordPress is referred to a widget-ready area used by WordPress themes
> to display information that is not a part of the main content. It is not always
> a vertical column on the side. It can be a horizontal rectangle below or above
> the content area, footer, header, or any where in the theme. which displays widgets
> in a grid using Masonry. For this theme, whenever a widget is changed/added/removed/
> reordered, the sidebar needs to be reflowed.
> In order to allow themes to reflow sidebars and widgets to reinitialize their 
> contents after a refresh, the selective refresh framework introduces `widget-updated`
> and `sidebar-updated` events. Additionally, since **re-ordering widgets in a sidebar
> is instant** by just re-ordering the elements in the DOM, some widgets with dynamically-
> generated `iframe`s (such as a Twitter widget) may need to also be rebuilt, and
> for this reason there is a `partial-content-moved` event.
> For the above reasons, I believe it will be much more common for widgets (and 
> sidebars) to need special support for selective refresh, and so I think that at
> least for 4.5 the selective refresh should be opt-in for widgets (and perhaps 
> in themes for sidebars). See [theme support for Twenty Thirteen](https://github.com/xwp/wp-customize-partial-refresh/blob/master/js/theme-support/twentythirteen.js)
> and [plugin support for a few widgets in Jetpack](https://github.com/xwp/wp-customize-partial-refresh/blob/master/js/plugin-support/jetpack.js)(
> which won’t be part of the merge). At last week’s Core dev meeting, it was [suggested](https://wordpress.slack.com/archives/core/p1455140954002374)
> that we add the opt-in for widget selective refresh at RCrelease candidate One
> of the final stages in the version release cycle, this version signals the potential
> to be a final release to the public. Also see [alpha (beta)](https://make.wordpress.org/core/tag/4-5+dev-notes/?output_format=md#alpha-beta)..

So as noted, selective refresh for widgets will be opt-in as of 4.5 RC1 (see [#35855](https://core.trac.wordpress.org/ticket/35855)).

**What do themes and widgets need to do to opt-in for selective refresh support?**

Selective refresh will be used for previewing a widget change when both the theme
and the widget itself indicate support as follows:

### Adding Theme Support

If your theme does not do anything fancy with its sidebars (such as using Masonry
to lay out widgets), then all that you need to do is add the following to your theme:

    ```notranslate
    add_theme_support( 'customize-selective-refresh-widgets' );
    ```

On the other hand, if the theme _is_ rendering a sidebar in a unique way, then to
add a bit of logic to handle the changes properly. For example, as noted previously
the footer area in Twenty Thirteen consists of a sidebar that is laid out using 
Masonry. When a widget is added, removed, or updated, the Masonry logic needs to
be re-run to update the positioning of the widgets in the sidebar. The following
highlighted code is what handles this:

    ```notranslate
    jQuery( function( $ ) {
    	var widgetArea = $( '#secondary .widget-area' );
    	widgetArea.masonry( {
    		itemSelector: '.widget',
    		columnWidth: columnWidth,
    		gutterWidth: 20,
    		isRTL: body.is( '.rtl' )
    	} );

    	if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
    		wp.customize.selectiveRefresh.bind( 'sidebar-updated', function( sidebarPartial ) {
    			if ( 'sidebar-1' === sidebarPartial.sidebarId ) {
    				widgetArea.masonry( 'reloadItems' );
    				widgetArea.masonry( 'layout' );
    			}
    		} );
    	}
    } );
    ```

**Update 2016-07-17**: Added the `jQuery()` DOM `ready` wrapper around this logic
to ensure it runs after the DOM has been fully loaded, and thus ensuring the `wp.
customize.selectiveRefresh` object exists if it is going to be loaded. See ​#37390
as this also turned out to be broken in Twenty Thirteen.

Note the `if` statement is there so the code will only run in the Customizer preview
and if selective refresh is available (that is, if they are running 4.5 or later).

### Adding Widget Support

If your widget lacks any dynamic functionality with JavaScript initialization, adding
support just requires adding a `customize_selective_refresh` flag to the `$widget_options`
param when constructing the `WP_Widget` subclass. If you are enqueueing any CSSCSS
Cascading Style Sheets. for styling the widget, you’ll also want to enqueue this
unconditionally in the Customizer preview (if `is_customize_preview()`) so that 
a widget can be added to the preview and be styled properly without doing a full
page refresh. For example, note these highlighted lines in a sample widget:

    ```notranslate
    class Example_Widget extends WP_Widget {

    	public function __construct() {
    		parent::__construct(
    			'example',
    			__( 'Example', 'my-plugin' ),
    			array(
    				'description' => __( 'Selective refreshable widget.', 'my-plugin' ),
    				'customize_selective_refresh' => true,
    			)
    		);

    		// Enqueue style if widget is active (appears in a sidebar) or if in Customizer preview.
    		if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) {
    			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
    		}
    	}

    	public function enqueue_scripts() {
    		wp_enqueue_style( 'my-plugin-example-widget', plugins_url( 'example-widget.css', __FILE__ ), array(), '0.1' );
    	}

    	/* ... */
    }
    ```

On the other hand, as with sidebars in a theme, if a widget uses JavaScript for 
initialization, you’ll need to add logic to make sure re-initialization happens 
when the widget is selectively refreshed. So in addition to the above example, you
must:

 1. Enqueue any dependent JS logic if `is_customize_preview()` just as noted above 
    for enqueueing any CSS stylesheet.
 2. Add a handler for `partial-content-rendered` selective refresh events to rebuild
    a widget’s dynamic elements when it is re-rendered.
 3. As needed, add a handler for `partial-content-moved` selective refresh events to
    refresh partials if any dynamic elements involve `iframe`s that have dynamically-
    written documents (such as the Twitter Timeline widget). (Adding this event handler
    should normally not be required.)

The Twitter Timeline widget in the Jetpack 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/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. is a good example for how to write
these event handlers:

    ```notranslate
    jQuery( function() {
    	// Short-circuit selective refresh events if not in customizer preview or pre-4.5.
    	if ( 'undefined' === typeof wp || ! wp.customize || ! wp.customize.selectiveRefresh ) {
    		return;
    	}

    	// Re-load Twitter widgets when a partial is rendered.
    	wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) {
    		if ( placement.container ) {
    			twttr.widgets.load( placement.container[0] );
    		}
    	} );

    	// Refresh a moved partial containing a Twitter timeline iframe, since it has to be re-built.
    	wp.customize.selectiveRefresh.bind( 'partial-content-moved', function( placement ) {
    		if ( placement.container && placement.container.find( 'iframe.twitter-timeline:not([src]):first' ).length ) {
    			placement.partial.refresh();
    		}
    	} );
    } );
    ```

(This is adapted from a [pending PR](https://github.com/Automattic/jetpack/pull/3543)
for Jetpack.)

### Conclusion

All core themes and core widgets will have support for selective refresh in 4.5.
Now it’s up to theme and plugin authors to also add support to also start taking
advantage of these drastic performance improvements for previewing widget changes.

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#customize](https://make.wordpress.org/core/tag/customize/),
[#dev-notes](https://make.wordpress.org/core/tag/dev-notes/), [#feature-selective-refresh](https://make.wordpress.org/core/tag/feature-selective-refresh/)

 [  ](https://profiles.wordpress.org/joemcgill/) [Joe McGill](https://profiles.wordpress.org/joemcgill/)
3:46 pm _on_ March 12, 2016     
Tags: 4.5, [dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/),
[images ( 10 )](https://make.wordpress.org/core/tag/images/), [media ( 93 )](https://make.wordpress.org/core/tag/media/),
[optimization ( 7 )](https://make.wordpress.org/core/tag/optimization/), [performance ( 419 )](https://make.wordpress.org/core/tag/performance/)

# 󠀁[Performance improvements for images in WordPress 4.5](https://make.wordpress.org/core/2016/03/12/performance-improvements-for-images-in-wordpress-4-5/)󠁿

WordPress 4.5 includes a few performance enhancements for images.

## 󠀁[󠀁[Increased image compression for custom sizes

WordPress 4.5 increases the amount of compression applied to intermediate sizes 
by changing the default quality in `WP_Image_Editor` from 90 to 82. As noted in 
[the proposal](https://make.wordpress.org/core/2016/02/22/proposal-increase-the-default-image-compression-in-wordpress/)
for this change, this results in a noticeable reduction in file sizes with little
change in visual quality. Developers can override the default image quality value
using the `wp_editor_set_quality` filterFilter Filters are one of the two types 
of Hooks [https://codex.wordpress.org/Plugin_API/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..

## 󠀁[󠀁[Improved resizing settings for ImageMagick

For sites making use of ImageMagick, we’ve reduced file sizes further by resizing
images  more efficiently in `WP_Image_Editor_Imagick` and by stripping extraneous
metadata using the new `WP_Image_Editor_Imagick::strip_image()` method.

For now, ‘icc’ and ‘icm’ color profiles are retained, along with ‘exif’, ‘xmp’, 
and ‘iptc’ profiles, which can contain copyright and orientation data. Those who
want to retain additional metadata can disable profile stripping by adding a callback
function to the `image_strip_meta` hook that returns `false`.

Note that the original full sized images uploaded to WordPress are unaffected by
these changes.

## 󠀁[󠀁[Introduction of `wp_get_upload_dir()`

As Jeremy Felt mentioned in [his post on Multisite changes](https://make.wordpress.org/core/2016/03/09/multisite-focused-changes-in-4-5/),`
wp_upload_dir()` received a major performance overhaul in this release. Those changes
were pared with the addition of a new function, `wp_get_upload_dir()`, which can
be used as a more performant way to display information about the uploads directory
on the front end. This is particularly useful when building URLs for images in templates.(
See [#34359](https://core.trac.wordpress.org/ticket/34359))

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#images](https://make.wordpress.org/core/tag/images/), [#media](https://make.wordpress.org/core/tag/media/),
[#optimization](https://make.wordpress.org/core/tag/optimization/), [#performance](https://make.wordpress.org/core/tag/performance/)

 [  ](https://profiles.wordpress.org/swissspidy/) [Pascal Birchler](https://profiles.wordpress.org/swissspidy/)
9:29 pm _on_ March 11, 2016     
Tags: 4.5, [dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/),
[embeds ( 10 )](https://make.wordpress.org/core/tag/embeds/)   

# 󠀁[Embeds Changes in WordPress 4.5](https://make.wordpress.org/core/2016/03/11/embeds-changes-in-wordpress-4-5/)󠁿

After the introduction of the embeds feature in WordPress 4.4 there have been a 
few significant changes in 4.5 to make embeds more robust and easier to customize.
🎉

## Embed Code Adjustments

Tickets: [#35804](https://core.trac.wordpress.org/ticket/35804), [#35894](https://core.trac.wordpress.org/ticket/35894)

There were two minor changes to the `<iframe>` embed code:

 1. The iframeiframe iFrame is an acronym for an inline frame. An iFrame is used inside
    a webpage to load another HTML document and render it. This HTML document may also
    contain JavaScript and/or CSS which is loaded at the time when iframe tag is parsed
    by the user’s browser.’s `title` attribute has been adjusted to better describe
    its content for improved 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).
 2. The iframe is now hidden using a different technique to prevent images from not
    being displayed properly in Firefox, working around a known 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. in that browser.

## Discovery Improvements

Ticketticket Created for both bug reports and feature development on the bug tracker.:
[#35979](https://core.trac.wordpress.org/ticket/35979)

Since WordPress 4.4, oEmbed discovery has been turned on by default. Using auto 
discovery, WordPress tries to find embeddable content when a URLURL A specific web
address of a website or web page on the Internet, such as a website’s URL www.wordpress.
org is pasted on a new line in the editor. [[36880]](https://core.trac.wordpress.org/changeset/36880)
prevents timeouts from happening when requesting the URL by limiting the response
size to 150KB.

## Embedding Static Front Pages

Ticket: [#34971](https://core.trac.wordpress.org/ticket/34971)

Previously, embedding a static front pageStatic Front Page A WordPress website can
have a dynamic blog-like front page, or a “static front page” which is used to show
customized content. Typically this is the first page you see when you visit a site
url, like wordpress.org for example. was not possible due to not having an `/embed/`
endpoint. Now `embed` is a reserved slug that can’t be used for new pages/posts.
When `https://example.com/foo/embed/` is an existing page, embeds fall back to `
https://example.com/foo/?embed=true`.

## Embed Template Changes

![Displays select embed template and template part locations, as well as various
areas of an example embed view. Covers embed.php, the_embed_site_title(), embed-
content.php, the_excerpt_embed(), and print_embed_sharing_options().](https://make.
wordpress.org/core/files/2016/03/embed_parts_4.5.png)

Tickets: [#35322](https://core.trac.wordpress.org/ticket/35322), [#35630](https://core.trac.wordpress.org/ticket/35630),
[#34561](https://core.trac.wordpress.org/ticket/34561)

 * The site icon in the embed template used to fall back to an image located inside`/
   wp-admin/`. This was problematic when the directory is not accessible to the 
   public. That image is now loaded from inside `/wp-includes/`.
 * Thanks to an adjusted click event handler, links inside the iframe now work even
   when they’re inserted dynamically after the page load.
 * By far the biggest changes affect the way the embed template is loaded 💪🏽. 
   Most notably, the old `wp-includes/embed-template.php` file has been deprecated
   and split into five new template parts that can be individually overridden by
   themes:
    - embed.php
    - embed-404.php
    - embed-content.php
    - 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.-embed.php
    - footer-embed.php

The five new template parts live in `/wp-includes/theme-compat/` and allow coreCore
Core is the set of software required to run WordPress. The Core Development Team
builds WordPress. to gracefully fall back should themes prefer not to override any
or all of them.

Previously, the embed template could only be changed using the `embed_template` 
filterFilter Filters are one of the two types of Hooks [https://codex.wordpress.org/Plugin_API/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.. This filter can now be leveraged directly within the template hierarchy
via the already-existing [`{$type}_template`](https://developer.wordpress.org/reference/hooks/type_template)
filter (where `$type` equals “embed”).

See [`get_query_template()`](https://developer.wordpress.org/reference/functions/get_query_template)
and [`locate_template()`](https://developer.wordpress.org/reference/functions/locate_template)
for more information.

See [[36693]](https://core.trac.wordpress.org/changeset/36693) for the relevant 
changeset.

## Embeds in the Template Hierarchy

Ticket: [#34278](https://core.trac.wordpress.org/ticket/34278)

In addition to the new base `embed.php` template and related template parts, themes
can now implement embed templates for specific post types and post formats within
the confines of the template hierarchy. The embeds template cascade looks like this:

 * `embed-{post-type}-{post_format}.php`
 * `embed-{post-type}.php`
 * `embed.php`
 * `wp-includes/theme-compat/embed.php`

Note that this is the first time direct `theme-compat` inheritance has been integrated
with the template hierarchy. This approach allows core to provide basic, yet standardized
templates and template parts for handling post embeds.

To leverage the core embed template parts, simply use standard `get_template_part()`
calls within your themes. The template hierarchy will do the rest.

For example:

 * If the theme is leveraging its own version of `embed.php` template, it would 
   likely call template parts directly, e.g. `get_template_part( 'embed', 'content');`
 * If the theme is relying on the core embed template parts – i.e. not providing
   its own `embed-content.php` file – the template hierarchy would fall back to 
   using `wp-includes/theme-compat/embed-content.php`, and so on.

See [[36876]](https://core.trac.wordpress.org/changeset/36876) for the relevant 
changeset.

 For more information on extending embeds within the scope of the template hierarchy,
check out the new [Embeds section](https://developer.wordpress.org/themes/basics/template-hierarchy/#embeds)
in the Template Hierarchy reference in the Theme Developer handbook.

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#embeds](https://make.wordpress.org/core/tag/embeds/)

 [  ](https://profiles.wordpress.org/westonruter/) [Weston Ruter](https://profiles.wordpress.org/westonruter/)
6:45 pm _on_ March 10, 2016     
Tags: 4.5, [customize ( 67 )](https://make.wordpress.org/core/tag/customize/),
[dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/)   

# 󠀁[Customizer Improvements in 4.5](https://make.wordpress.org/core/2016/03/10/customizer-improvements-in-4-5/)󠁿

In addition to the [~35](https://core.trac.wordpress.org/query?status=accepted&status=assigned&status=closed&status=new&status=reopened&status=reviewing&type=defect+(bug)&component=Customize&milestone=4.5&col=id&col=summary&col=milestone&col=status&col=owner&col=type&col=priority&col=severity&col=focuses&col=keywords&order=priority)
defects that were fixed in this release, there were also [~17](https://core.trac.wordpress.org/query?status=accepted&status=assigned&status=closed&status=new&status=reopened&status=reviewing&type=!defect+(bug)&component=Customize&milestone=4.5&col=id&col=summary&col=milestone&col=status&col=owner&col=type&col=priority&col=severity&col=focuses&col=keywords&order=priority)
features and enhancements that were made. What follows are some highlights, starting
with some smaller enhancements and then listing out full posts that document the
larger features.

### Setting-less Controls (󠀁[#35926](https://core.trac.wordpress.org/ticket/35926)󠁿)

 Sometimes controls need to be added which don’t directly have associated settings.
For example, there can be controls needed which manipulate some aspect of 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. interface or manage
the behavior of other controls and their settings: consider a control for managing
repeating controls, where the button only serves to create other controls and their
settings. When nav menus were added in the Customizer in 4.3, the UIUI User interface
for creating a new menu involved two controls which had custom settings associated
them (create_new_menu and new_menu_name) which served no purpose other than to make
sure the control wouldn’t raise an error. The settings had custom types to prevent
them from getting saved to the DB. In 4.5, controls are no longer required to have
associated settings. By default registering a control without an explicit `settings`
argument will result in the control’s own `id` being supplied as the associated 
setting `id`. To explicitly register a control without any associated settings, 
pass an empty array as the `settings`:

    ```notranslate
    $wp_customize->add_control( 'new-post', array(
    	'section'  => 'title_tagline',
    	'settings' => array(),
    	'type' => 'button',
    	'input_attrs'  => array(
    		'value' => __( 'Add Post' ),
    	),
    	'capability' => 'edit_posts',
    ) );
    ```

 Because controls no longer require settings, controls now accept a `capability`
argument (as seen above) whereas previously a control’s capabilitycapability A **
capability** is permission to perform one or more types of task. Checking if a user
has a capability is performed by the `current_user_can` function. Each user of a
WordPress site might have some permissions but not others, depending on their role.
For example, users who have the Author role usually have permission to edit their
own posts (the “edit_posts” capability), but not permission to edit other users’
posts (the “edit_others_posts” capability). would depend on the capabilitiescapability
A **capability** is permission to perform one or more types of task. Checking if
a user has a capability is performed by the `current_user_can` function. Each user
of a WordPress site might have some permissions but not others, depending on their
role. For example, users who have the Author role usually have permission to edit
their own posts (the “edit_posts” capability), but not permission to edit other 
users’ posts (the “edit_others_posts” capability). of its associated settings. A
control will not be displayed if it has a defined `capability` which the user doesn’t
have, _or_ if the user doesn’t have the `capability` required for any of the associated
settings. If you omit the `capability` for a setting-less control, it will be displayed
to all users (who can `customize`).

### Other Improvements

 * Shift-click on nav menu items in preview to open corresponding control in Customizer
   pane ([#26005](https://core.trac.wordpress.org/ticket/26005)).
 * Shift-click on site title and tagline for CoreCore Core is the set of software
   required to run WordPress. The Core Development Team builds WordPress. themes
   and any that implement selective refresh partials for these settings. Focus on
   the control for any setting in the preview by sending a `focus-control-for-setting`
   message to the pane, passing the setting ID. This is used to focus on controls
   when a shift-click is done on a selective refresh partial.
 * Site title and tagline will be updated via selective refresh in core themes. (
   [#33738](https://core.trac.wordpress.org/ticket/33738))
 * `WP_Customize_Manager::add_*()` methods now return the added instance. ([#34596](https://core.trac.wordpress.org/ticket/34596))
 * `WP_Customize_Manager::add_setting()` now applies the relevant dynamic setting
   filters. ([#34597](https://core.trac.wordpress.org/ticket/34597))
 * There is a new `customize_nav_menu_searched_items` filterFilter Filters are one
   of the two types of Hooks [https://codex.wordpress.org/Plugin_API/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. for nav menu item searches. ([#34947](https://core.trac.wordpress.org/ticket/34947))
 * The `WP_Customize_Media_Control` now allows its `button_labels` to be overridden.(
   [#35542](https://core.trac.wordpress.org/ticket/35542))
 * The setting models in the preview now have a `id` property and `_dirty` flag 
   to correspond to the settings in the pane; dynamically created settings in the
   pane will be created in the preview. ([#35616](https://core.trac.wordpress.org/ticket/35616))
 * More config settings are exported to the preview to allow the preview to do more
   operations inline, including more nonces, the current theme, and the previewed
   URLURL A specific web address of a website or web page on the Internet, such 
   as a website’s URL www.wordpress.org. ([#35617](https://core.trac.wordpress.org/ticket/35617))

### Dedicated Feature Posts

#### Device Preview (󠀁[#31195](https://core.trac.wordpress.org/ticket/31195)󠁿)

 https://make.wordpress.org/core/2016/01/28/previewing-site-responsiveness-in-the-
customizer/

#### Selective Refresh (󠀁[#27355](https://core.trac.wordpress.org/ticket/27355)󠁿)

 https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/

#### Custom Logo (󠀁[#33755](https://core.trac.wordpress.org/ticket/33755)󠁿)

 https://make.wordpress.org/core/2016/03/10/custom-logo/

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#customize](https://make.wordpress.org/core/tag/customize/),
[#dev-notes](https://make.wordpress.org/core/tag/dev-notes/)

 [  ](https://profiles.wordpress.org/obenland/) [Konstantin Obenland](https://profiles.wordpress.org/obenland/)
5:57 pm _on_ March 10, 2016     
Tags: 4.5, custom-logo, [dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/)

# 󠀁[Custom Logo](https://make.wordpress.org/core/2016/03/10/custom-logo/)󠁿

New in 4.5 is the ability for users to add a logo to their sites (if their theme
has declared support for it). It’s an addition to the Custom 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. and Custom Background
features which themes have to declare support for as well, and works pretty much
just like them.

To register support, a theme would add the following call in a callback to the `
after_setup_theme` action:

    ```notranslate
    function theme_prefix_setup() {
    	add_theme_support( 'custom-logo' );
    }
    add_action( 'after_setup_theme', 'theme_prefix_setup' );
    ```

Theme support for custom logos accepts five parameters, added in an arguments array:

 * `height
    
   (int) Expected logo height in pixels.
    Themes can use built-in image
   sizes (like thumbnail) or register a custom image size and use that.
 * `width
    
   (int) Expected logo width in pixels.
 * `flex-height
    
   (boolean) Whether to allow for a flexible height.
    Showing the
   logo in a vertical sidebarSidebar A sidebar in WordPress is referred to a widget-
   ready area used by WordPress themes to display information that is not a part
   of the main content. It is not always a vertical column on the side. It can be
   a horizontal rectangle below or above the content area, footer, header, or any
   where in the theme. (like Twenty Fifteen) is a good example for when a flexible
   height can make sense.
 * `flex-width
    
   (boolean) Whether to allow for a flexible width.
    If a theme has
   room horizontally, flex-width gives users more freedom in how their logo can 
   be displayed. Example:
 *     ```notranslate
       add_theme_support( 'custom-logo', array(
          'height'      => 175,
          'width'       => 400,
          'flex-width' => true,
       ) );
       ```
   
 * `header-text`
    (array) Class name(s) of elements to hide. This parameter is only
   important for (the very few) themes that **do not** also support hiding the header
   text in custom headers. Themes can pass an array of class names here for all 
   elements constituting header text that could be replaced by a logo.
 *     ```notranslate
       add_theme_support( 'custom-logo', array(
          'header-text' => array( 'site-title', 'site-description' ),
       ) );
       ```
   

Not only will this enable 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. control to add a custom logo, it will also add 
a body class of `wp-custom-logo` that can be used to style the logo if present. **
Important**: When adding support in your theme, please make sure to test setting
a new logo in the customizer with your theme active **and** in Live Preview. You
also want to make sure that the theme has styles in place to accommodate logos that**
don’t** have your custom image size (if you chose to add one), like images that 
have been uploaded before your theme was activated or updated, since they default
to the full size.

To manage displaying a custom logo in the front-end, these three template tags can
be used:

 * `get_custom_logo( $blog_id = 0 )`
    Returns markup for a custom logo.
 * `the_custom_logo( $blog_id = 0 )`
    Displays markup for a custom logo.
 * `has_custom_logo( $blog_id = 0 )`
    Returns a boolean true/false, whether a custom
   logo is set or not.

To be able to use the new template tags and maintain backwards compatibility with
older versions of WordPress it is recommended to wrap these functions in a `function_exists()`
call, similar to how Twenty Sixteen does it:

    ```notranslate
    function twentysixteen_the_custom_logo() {
       if ( function_exists( 'the_custom_logo' ) ) {
          the_custom_logo();
       }
    }
    ```

The latest two default themes will be updated with support for this brand new feature
as soon as WordPress 4.5 ships. Themes that have been using Jetpack’s Site Logo 
implementation will not need to be updated—Jetpack will do a migrationMigration 
Moving the code, database and media files for a website site from one server to 
another. Most typically done when changing hosting companies. behind the scenes 
to work with it out of the box.

A small under the hood goodie: Custom logos utilizes the Customizer’s brand new 
Selective Refresh feature, allowing for super fast changes without having to reload
the entire preview. It also let’s users shift-click the logo in the preview to open
the corresponding customizer section.

[EDIT]: As of [[37077]](https://core.trac.wordpress.org/changeset/37077), Custom
Logo does not support the `size` argument anymore. Specifying the logo size in individual
arguments has the advantage of only creating a special image file for the specific
logo used (and not every image uploaded), and providing more parity with how Custom
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. works.

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#custom-logo](https://make.wordpress.org/core/tag/custom-logo/),
[#dev-notes](https://make.wordpress.org/core/tag/dev-notes/)

 [  ](https://profiles.wordpress.org/rachelbaker/) [Rachel Baker](https://profiles.wordpress.org/rachelbaker/)
8:02 pm _on_ March 9, 2016     
Tags: 4.5, [comments ( 27 )](https://make.wordpress.org/core/tag/comments/),
[dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/)   

# 󠀁[Comment Changes in WordPress 4.5](https://make.wordpress.org/core/2016/03/09/comment-changes-in-wordpress-4-5/)󠁿

WordPress 4.5 includes several ancient 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. fixes and a few enhancements
in the Comments component. We have closed 25 tickets. [Check out the full list of changes](https://core.trac.wordpress.org/query?status=closed&component=Comments&milestone=4.5&group=resolution&col=id&col=summary&col=owner&col=type&col=priority&col=component&col=version&order=priority).

## Moderate Comment Screen Refresh

 This often neglected screen has received a UXUX User experience update. Don’t know
what the “Moderate Comment” screen is? This is where you land when clicking one 
of the moderation actions from a comment notification email message. Changes of 
note:

 * Comment content is formatted for display, instead of one massive 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. of
   escaped text
 * Include navigation via a text link to the Edit Comment screen at the bottom of
   the comment
 * Updated message styles that match other screens
 * Only wrap the comment date in a link if the comment permalink exists to avoid
   confusion
 * Appended `#wpbody-content` to the comment email message links for 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)

 Before: ⌊34133-before⌉ After: ⌊34133-after⌉ See [#34133](https://core.trac.wordpress.org/ticket/34133)

## Max Lengths for Comment Form Fields

 Be verbose without having to worry that your insightful words will be lost. The
comment form will now enforce the maximum length of each field’s respective database
column with hardcoded `maxlength` attributes. The hardcoded `maxlength` attributes
can be adjusted for custom database schemas by using the `comment_form_default_fields`
filterFilter Filters are one of the two types of Hooks [https://codex.wordpress.org/Plugin_API/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.. The default length settings are as follows:

 * Comment: 65525 characters
 * Name : 245 characters
 * Email: 100 characters
 * Url: 200 characters

 Comments will also have the input lengths checked by the new function `wp_get_comment_fields_max_lengths()`,
and accompanying filter `wp_get_comment_fields_max_lengths`, upon submission returning
a `WP_Error` object if any value is longer than its database column. See [#10377](https://core.trac.wordpress.org/attachment/ticket/10377).

## Comment Error Page Navigation

 Previously, visitors who submitted a comment that was unable to be processed were
shown an error message without a method to navigate back to their comment. Your 
potential commenter would have to use their browser’s back button to get back to
their comment to resolve the error. A simple back link has been added to the bottom
of the error message page. See the screenshots below. Before: ⌊4332-before⌉ After:⌊
4332-after⌉ See [#4332](https://core.trac.wordpress.org/ticket/4332).

## Other Changes of Note

 * The `rel=nofollow` attribute and value pair will no longer be added to relative
   or same domain links within `comment_content`. See [#11360](https://core.trac.wordpress.org/ticket/11360).
 * `WP_Comment_Query` now supports the `author_url` parameter. See [#36224](https://core.trac.wordpress.org/ticket/36224).
 * The new `pre_wp_update_comment_count_now` filter allows you to bail out of updating
   the comment count for a given Post. See [#35060](https://core.trac.wordpress.org/ticket/35060)

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#comments](https://make.wordpress.org/core/tag/comments/),
[#dev-notes](https://make.wordpress.org/core/tag/dev-notes/)

 [  ](https://profiles.wordpress.org/jeremyfelt/) [Jeremy Felt](https://profiles.wordpress.org/jeremyfelt/)
7:05 am _on_ March 9, 2016     
Tags: 4.5, [dev-notes ( 648 )](https://make.wordpress.org/core/tag/dev-notes/),
[multisite ( 90 )](https://make.wordpress.org/core/tag/multisite/)   

# 󠀁[Multisite Focused Changes in 4.5](https://make.wordpress.org/core/2016/03/09/multisite-focused-changes-in-4-5/)󠁿

Howdy! The 4.5 release cycle was relatively quiet for 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**,
though we still managed to knock out a few good things. The following is a brief
rundown of each, full details can be found in the [full list of multisite focused changes](https://core.trac.wordpress.org/query?focuses=~multisite&milestone=4.5&group=milestone&col=id&col=summary&col=milestone&col=status&col=owner&col=type&col=priority&order=priority)
for 4.5. 💫

### Introduce WP_Site

The global `$current_blog` has always been used as a way to store the properties
in a `stdClass` object of the current site during bootstrap. With the introduction
of `WP_Site`, we add some definition and have a more proper object to pass around.
Sweet.

Take a look at `ms-settings.php` if you are using a custom sunrise.php to populate
the `$current_blog` global. We now create a `WP_Site` object from the existing `
$current_blog` if it has been populated elsewhere. This is a backward compatible
change, though should be tested wherever your code interacts with `$current_blog`,
especially if anything has been done to extend its structure.

This last paragraph may sound familiar to you because I copied it from the notes
on the work we did in the [4.4 release](https://make.wordpress.org/core/2015/10/28/multisite-focused-changes-in-4-4/)
to add `WP_Network` as an object. In future releases, we’ll continue to build these
out with query classes as well.

See [#32450](https://core.trac.wordpress.org/ticket/32450) for all the details.

### New Actions and Filters

 * `network_user_new_form` fires at the end of the networknetwork (versus site, 
   blog)’s Add New User form. [#15389](https://core.trac.wordpress.org/ticket/15389)
 * `network_site_new_form` fires at the end of the network’s Add New Site form. 
   [#34739](https://core.trac.wordpress.org/ticket/34739)
 * `network_allowed_themes` and `site_allowed_themes` allow for more granular filtering
   of the themes allowed for a site. The legacy `allowed_themes` will continue to
   do its job. [#28436](https://core.trac.wordpress.org/ticket/28436)
 * `pre_network_site_pre_created_user` fires right before a new user is created 
   during the Add New Site process if one does not already exist. [#33631](https://core.trac.wordpress.org/ticket/33631)

### Other interesting things

 * Use a usermeta key rather than a site option keyed to the user ID when a user
   changes their email address and confirmation is needed. [#23358](https://core.trac.wordpress.org/ticket/23358)
 * In subdomain installations, if a user attempted to login to a site they did not
   have access to on the network, they would be shown an access denied message with
   a list of authorized sites. This differed from the behavior in subdirectory installs,
   where the user would be redirected to either their profile page or the dashboard
   of their primary site. In 4.5, the subdomain behavior now matches the subdirectory
   behavior. [#30598](https://core.trac.wordpress.org/ticket/30598)
 * The performance of `wp_upload_dir()` has been improved, specifically via persistent
   cache. This isn’t necessarily multisite related, though you should probably be
   familiar with the change. [#34359](https://core.trac.wordpress.org/ticket/34359)
 * Show the `home` URLURL A specific web address of a website or web page on the
   Internet, such as a website’s URL www.wordpress.org rather than `siteurl` in `
   site-info.php` and use the text “Site Address (URL)” for consistency with the
   similar site in single site. [#35632](https://core.trac.wordpress.org/ticket/35632)
 * Provide an “Edit user” link after adding a new user to a site or network. [#35705](https://core.trac.wordpress.org/ticket/35705)
   😻

And that’s about it. There may still be some 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. fixing in the next
week or so, but only if you get out there and test 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. against 
your plugins, themes, and crazy configurations. Have at it!

[#4-5](https://make.wordpress.org/core/tag/4-5/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#multisite](https://make.wordpress.org/core/tag/multisite/)

# Post navigation

[← Older posts](https://make.wordpress.org/core/tag/4-5+dev-notes/page/2/?output_format=md)