=== WordPress Importer === Contributors: wordpressdotorg Donate link: https://wordpressfoundation.org/donate/ Tags: importer, wordpress Requires at least: 3.6 Tested up to: 4.9 Stable tag: 0.6.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file. == Description == The WordPress Importer will import the following content from a WordPress export file: * Posts, pages and other custom post types * Comments * Custom fields and post meta * Categories, tags and terms from custom taxonomies * Authors For further information and instructions please see the [Codex page on Importing Content](https://codex.wordpress.org/Importing_Content#WordPress) == Installation == The quickest method for installing the importer is: 1. Visit Tools -> Import in the WordPress dashboard 1. Click on the WordPress link in the list of importers 1. Click "Install Now" 1. Finally click "Activate Plugin & Run Importer" If you would prefer to do things manually then follow these instructions: 1. Upload the `wordpress-importer` folder to the `/wp-content/plugins/` directory 1. Activate the plugin through the 'Plugins' menu in WordPress 1. Go to the Tools -> Import screen, click on WordPress == Changelog == = 0.6.4 = * Improve PHP7 compatibility. * Fix bug that caused slashes to be stripped from imported comments. * Fix for various deprecation notices including `wp_get_http()` and `screen_icon()`. * Fix for importing export files with multiline term meta data. = 0.6.3 = * Add support for import term metadata. * Fix bug that caused slashes to be stripped from imported content. * Fix bug that caused characters to be stripped inside of CDATA in some cases. * Fix PHP notices. = 0.6.2 = * Add `wp_import_existing_post` filter, see [Trac ticket #33721](https://core.trac.wordpress.org/ticket/33721). = 0.6 = * Support for WXR 1.2 and multiple CDATA sections * Post aren't duplicates if their post_type's are different = 0.5.2 = * Double check that the uploaded export file exists before processing it. This prevents incorrect error messages when an export file is uploaded to a server with bad permissions and WordPress 3.3 or 3.3.1 is being used. = 0.5 = * Import comment meta (requires export from WordPress 3.2) * Minor bugfixes and enhancements = 0.4 = * Map comment user_id where possible * Import attachments from `wp:attachment_url` * Upload attachments to correct directory * Remap resized image URLs correctly = 0.3 = * Use an XML Parser if possible * Proper import support for nav menus * ... and much more, see [Trac ticket #15197](https://core.trac.wordpress.org/ticket/15197) = 0.1 = * Initial release == Upgrade Notice == = 0.6 = Support for exports from WordPress 3.4. = 0.5.2 = Fix incorrect error message when the export file could not be uploaded. = 0.5 = Import comment meta and other minor bugfixes and enhancements. = 0.4 = Bug fixes for attachment importing and other small enhancements. = 0.3 = Upgrade for a more robust and reliable experience when importing WordPress export files, and for compatibility with WordPress 3.1. == Frequently Asked Questions == = Help! I'm getting out of memory errors or a blank screen. = If your exported file is very large, the import script may run into your host's configured memory limit for PHP. A message like "Fatal error: Allowed memory size of 8388608 bytes exhausted" indicates that the script can't successfully import your XML file under the current PHP memory limit. If you have access to the php.ini file, you can manually increase the limit; if you do not (your WordPress installation is hosted on a shared server, for instance), you might have to break your exported XML file into several smaller pieces and run the import script one at a time. For those with shared hosting, the best alternative may be to consult hosting support to determine the safest approach for running the import. A host may be willing to temporarily lift the memory limit and/or run the process directly from their end. -- [WordPress Codex: Importing Content](https://codex.wordpress.org/Importing_Content#Before_Importing) == Filters == The importer has a couple of filters to allow you to completely enable/block certain features: * `import_allow_create_users`: return false if you only want to allow mapping to existing users * `import_allow_fetch_attachments`: return false if you do not wish to allow importing and downloading of attachments * `import_attachment_size_limit`: return an integer value for the maximum file size in bytes to save (default is 0, which is unlimited) There are also a few actions available to hook into: * `import_start`: occurs after the export file has been uploaded and author import settings have been chosen * `import_end`: called after the last output from the importer Cumulative Layout Shift (CLS) – Defined, Measured, & How to Fix – Reflex The Best

Cumulative Layout Shift (CLS) – Defined, Measured, & How to Fix


Cumulative Layout Shift (CLS) measures the visual stability of a page as it loads. It does this by looking at how big elements are and how far they move. It’s one of the three Core Web Vitals metrics Google uses to measure page experience.

CLS is calculated during the five-second window where the most shifting occurs.

Sidenote.

Expected layout shifts, like after a user action, are fine and expected. Shifts within 500 ms of a user interaction are excluded from the calculations.

Here’s how it’s measured:

layout shift score = impact fraction x distance fraction

Or said in a more understandable way, it’s:

layout shift score = % of the viewport that changed * the distance an unstable element moved

The reason CLS is important is it’s annoying when you try to click something on a page that shifts and then end up clicking on something you don’t intend to. 

It happens to me all the time. I click on one thing and, suddenly, I’m clicking on an ad and am now not even on the same website. As a user, I find that frustrating.

Click a link that shifts, showing a layout shift and why it's an issue

Common causes of CLS include:

  • Images without dimensions.
  • Ads, embeds, and iframes without dimensions.
  • Injecting content with JavaScript.
  • Applying fonts or styles late in the load.

Let’s look at what your CLS score should be and how to improve it.

What’s a good CLS score?

A good CLS score is less than or equal to 0.1 and should be based on Chrome User Experience Report (CrUX) data. This is data from actual users of Chrome who are on your site and have opted in to sharing this information. You need 75% of page loads to have a CLS score of 0.1 or lower.

Your page may be classified into one of the following buckets:

  • Good: <=0.1
  • Needs improvement: >0.1 and <=0.25
  • Poor: >0.25
CLS thresholds for good, needs improvement, and poor

CLS data

72.8% of sites have good CLS scores as of April 2023. This is averaged across the site. As we mentioned, you need 75% of page loads to have a CLS score of 0.1 or lower to be classified as good.

Percentage of good CLS values from CrUX CWV data as of April 2023

CLS is the most improved Core Web Vital since Google’s push for faster websites. 

Percentage of good CLS scores from CrUX CWV data from November 2019 to April 2023

When we ran a study at the page level using Site Audit data, we saw that CLS is similar on desktop and mobile.

Breakdown of CLS by device

We also noted many sites struggle with CLS, especially on slower connections.

Breakdown of CLS by connection type

CLS is worse in the page-level data than the origin data. It’s likely that people are improving their main pages, which get more traffic, while leaving a lot of other pages with failing scores.

Core Web Vitals metric breakdown at the page level instead of origin level

There are different ways of measuring CLS: field data and lab data. 

Field data comes from the Chrome User Experience Report (CrUX), which is data from real users of Chrome who choose to share their data. This gives you the best idea of real-world CLS performance. It’s also what you’ll actually be measured on by Google for Core Web Vitals. 

Lab data is based on tests with the same conditions to make tests repeatable. Google doesn’t use this for Core Web Vitals. But it’s useful for testing because CrUX/field data is a 28-day rolling average, so it takes a while to see the impact of changes.

The best tool to measure CLS depends on the type of data you want (lab/field) and whether you want it for one URL or many.

Measuring CLS for a single URL

Pagespeed Insights pulls page-level field data that you can’t otherwise query in the CrUX dataset. It also runs lab tests for you based on Google Lighthouse and gives you origin data so you can compare page performance to the entire site.

Measuring CLS for many URLs or an entire site

You can get CrUX data in Google Search Console that is bucketed into the categories of good, needs improvement, and poor.

Core Web Vitals data in Google Search Console

Clicking into one of the issues gives you a breakdown of page groups that are impacted. The groups are pages with similar values that likely use the same template. You make the changes once in the template, and that will be fixed across the pages in the group.

Page groups for CLS issues

If you want both lab data and field data at scale, the only way to get that is through the PageSpeed Insights API. You can connect to it easily with Ahrefs’ Site Audit and get reports detailing your performance. This is free for verified sites with an Ahrefs Webmaster Tools (AWT) account.

Core Web Vitals data in Ahrefs' Site Audit

Note that the Core Web Vitals data shown will be determined by the user-agent you select for your crawl during the setup. If you crawl from mobile, you’ll get mobile CWV values from the API.

In PageSpeed Insights, if you select CLS in the “Diagnostics” section, you can see all the related issues like “Avoid large layout shifts.” These are the issues you’ll want to solve.

Issues related to CLS in Google PageSpeed Insights

In most cases, to optimize CLS, you’re going to be working on issues related to images, fonts or, possibly, injected content. Let’s look at each case.

1. Reserve space for images, videos, iframes

For images, what you need to do is reserve the space so that there’s no shift and the image simply fills that space. This can mean setting the height and width of images by specifying them within the <img> tag like this:

<img src=“cat.jpg" width="640" height="360" alt=“cat with string" />

For responsive images, you need to use a srcset like this:

<img

width="1000"

height="1000"

src="https://ahrefs.com/blog/cumulative-layout-shift-cls/puppy-1000.jpg"

srcset="https://ahrefs.com/puppy-1000.jpg 1000w, https://ahrefs.com/puppy-2000.jpg 2000w, https://ahrefs.com/puppy-3000.jpg 3000w"

alt="Puppy with balloons" />

You’ll also want to reserve the space needed for things like videos and iframes. For dynamic content like ads, you will want to reserve the max space needed.

There’s also a relatively new CSS property called aspect-ratio that will allow you to set a dynamic width based on the screen size, and the browser will calculate the appropriate height for you.

2. Optimize fonts

For fonts, the goal is to get the font on the screen as fast as possible and to not swap it with another font. When a font is loaded or changed, you end up with a noticeable shift like a Flash of Invisible Text (FOIT) or Flash of Unstyled Text (FOUT).

If you can use a system font, do that. There’s nothing to load, so there are no delays or changes that will cause a shift.

If you have to use a custom font, the current best method for minimizing CLS is to combine <link rel=”preload”> (which is going to try to grab your font as soon as possible) and font-display: optional (which is going to give your font a small window of time to load). 

If the font doesn’t make it in time, the initial page load will simply show a default font. Your custom font will then be cached and show up on subsequent page loads.

3. Use animations that don’t trigger layout changes

There are some CSS property values that trigger layout shifts, such as “box-shadow,” “box-sizing,” “top,” “left,” and more that should not be animated. Instead, you’ll want to use “transform” animations to avoid layout shifts. 

4. Make sure your pages are eligible for bfcache

The back/forward cache keeps pages in the browser cache. It allows for instant loading of a page that was already loaded, meaning no layout shifts will happen. 

There’s a decent amount to this one optimization. The main strategies are listed below, and you can read more about them here.

Main strategies:

  • Never use the unload event
  • Minimize use of Cache-Control: no-store
  • Update stale or sensitive data after bfcache restore
  • Avoid window.opener references
  • Always close open connections before the user navigates away
  • Test to ensure your pages are cacheable

Final thoughts

Since CLS was introduced, we’ve already seen innovations like bfcache and CSS aspect-ratio that help with the issue. I expect that we’ll see more innovation and more new ways to prevent layout shifts in the future. 

If you have any questions, message me on Twitter.





Source link

tech
      Reflex The Best
      Logo