What's New in WordPress 4.7?

What's New in WordPress 4.7? pixelwork

What's New in WordPress 4.7?

WordPress 4.7 It's in beta 2 and there are some nice new features being added to the new version. Hopefully they will be released soon, but here are some of the features you can expect in WordPress 4.7.

Twenty Seventeen

As with every new WordPress release there is a new theme. WordPress, Twenty Seventeen:

  • It has a better flow to use a static page as the main page.
  • Edit icons visible in the Customizer, replacing the current shift+click method.
  • Custom extension of header images to include video.
  • Dummy content for live previews.

To discover more of the new features within WordPress it is always a good idea to look at the official theme information.

Further information: Twenty Seventeen

One of the best new features is the theme setup flow, which lists features to improve theme setup.

REST API Endpoints

Once again moving to Javascript, WordPress has made more improvements to the REST API. With the Content API merged in 4.7, it allows you to access:

  • Posts: Read and write access to all post data, for all data types, including pages and media.
  • Comments: Allows read and write access to all comment data. This includes pingbacks and trackbacks.
  • Terms: Read and write access to all data.
  • Users: Read and write access to all user data. This includes public access to some data for post-authors.
  • Meta: Read and write access to metadata for posts, comments, terms and users.

If you want to stay up to date with RESTful API changes, you can follow the Github report.


Changes in Multi Sites

Get_blog_details() is used to get information stored in the wp_blogs table, in 4.7 this has been replaced by the get_site() function as it will return the WP_Site object. You can still use get_blog_details for now but in WordPress 4.8 it will most likely be deprecated.

In line with the removal of get_blog_details() the blog_details filter has also been removed to be replaced by the site_details filters.

The wp_get_network() function is deprecated and it is recommended to use get_network() to return the WP_Network object to get all the multisite network information.

Post Type Tags

When you need to create a new post type in WordPress you will use the register_post_type() function, inside this function you will pass the tags that you want to call to the post type, there are two new post type tags added to the function.

View_items – This tag is used in the toolbar on the editing screen.
Attributes – This tag is used in the post meta attributes box.

Post Type Templates

WordPress has supported custom templates for years, but this has always been limited, if you want something different for a post you will have to use something like template_include to change the theme files used.

You can see an example of how to replace the theme post files here: (English) How to use page templates in a plugin

WordPress 4.7 now has the ability to define what post type a template can be used on using the Template Post Type file comment.

To create a custom page template, you must add a comment to the top of the file.

/** * Template Name: Product Offer Page */

For this to make changes to a post, you will need to use the Template Post Type comment.

/** * Template Name: Product Offer Page * Template Post Type: post, page, product */

Now we can use this template in post types, pages and posts. Like the page functionality, you will have a template selection dropdown list in the page attributes section in the admin area to select the template file to use for this post.

Resource Suggestions

In WordPress 4.6 support went to resources that allow you to define dns-prefetch, preconnect, prefetch and prerender. This tells the browser how to handle resources to help improve performance for loading your site.

Using the wp_resource_hints filter, you will be able to further change the attributes used in resource hints.

Array Utility Functions

Two new utility functions have been added to make working with arrays easier.

  • wp_list_sort()
  • WP_List_Util

Wp_list_sort() makes it easy to sort a list of objects by an attribute on that object. For example, if you have a list of WP_Post objects, you can now easily sort it by using:

$sorted_posts = wp_list_sort( $posts, 'post_date', 'DESC' )


Or, you can pass multiple options to sort using an array of options.

$sorted_posts = wp_list_sort( $posts, array( 'post_date' => 'DESC', 'post_title' => 'ASC', ) )


The WP_List_Util class is now your central point for managing list utilities.

Administration area languages

Version 4.7 allows you to select a language for a specific user, which can be changed in each user's profile.

[img url=”http://pixelwork.mx/wp-content/uploads/2016/11/user-admin-language-1-768×323-590×248.png” cls=”responsive”]

This allows the user to select their own locale which will change that user's language in the admin area. Previously, when setting up a locale for WordPress, all users needed to use this language, now each user can set their own language.


Source: paulund.co.uk