> ## Content Index
> Fetch the complete content index at: https://blog.sudowl.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Elementor on Mobile: PageSpeed 67 to 93 Without Touching the Theme
- URL: https://blog.sudowl.com/elementor-mobile-pagespeed-67-to-93/
- Published: 2026-11-17T19:00:00.000Z
- Updated: 2026-11-18T12:34:02.000Z
- Description: A client's Elementor site went from 67 to 93 on mobile Lighthouse: WebP, cache, LCP preload, lazy images, small inlined CSS. What worked, what I dropped.
- Author: Lukas
- Tags: Linux, Docker

A client's Elementor site scored 99 on desktop and 66 on mobile in Google's PageSpeed test. The main image on the home page showed up after 14 seconds on the simulated phone. The training page took 38 seconds. Desktop looked perfect, so nobody had noticed.

This week I got it to 92 or higher on the five main pages I measure, live. No new theme, no page rebuild, nothing deleted. Most of it is a handful of small mu-plugins.

**TL;DR:** Work on a local Docker copy from the backup, then a password protected preview. WebP plus a page cache gets you halfway. The rest was: preload the hero image per breakpoint, load the font as a stylesheet instead of `@import`, no entrance animation on the first section on mobile, lazy load every `<img>` on pages where the hero is a background image, inline only the small CSS files, drop plugin CSS on pages that don't use it, jQuery to the footer, emoji script off. Measure the median of 3 Lighthouse runs, never a single run.

## The numbers

Lighthouse 12.8.2, mobile profile, median of 3 runs each, live site before and after:

| Page          | Score   | LCP            | Page weight  |
| ------------- | ------- | -------------- | ------------ |
| Home          | 67 → 93 | 14.1 s → 2.5 s | 2.7 → 0.8 MB |
| Training page | 60 → 93 | 38.0 s → 2.9 s | 9.4 → 0.9 MB |
| Course page   | 68 → 92 | 15.8 s → 3.0 s | 4.1 → 0.6 MB |
| Members page  | 83 → 92 | 4.1 s → 3.0 s  | 3.3 → 0.7 MB |

It took two rounds. After round one the home page was at 81 with an LCP of 4.6 seconds on the preview. Better, but still orange, and Google's own test still showed it as not good enough. Round two got it into the 90s.

## How I measure

One Lighthouse run means nothing. The same page gave me 67, 67 and 71 back to back. So every number here is the median of 3:

```bash
for i in 1 2 3; do
  npx --yes lighthouse@12.8.2 "https://preview.example.com/" \
    --only-categories=performance --form-factor=mobile \
    --output=json --output-path="home-$i.json" --quiet \
    --chrome-flags="--headless=new" \
    --extra-headers='{"Authorization":"Basic dXNlcjpwYXNz"}'
done

```

`--extra-headers` gets you through basic auth on the preview. A small Python script prints the median of score, LCP, TBT and bytes. Pin the Lighthouse version, or before and after are measured by two different tools.

## Never on the live site

Rule from day one: nothing gets deleted on a client site. Not a plugin, not a page, not a file. Deactivate, noindex, 301 or block, but don't delete. And a backup before every change.

So the work happened elsewhere:

1. An UpdraftPlus backup of the live site, restored into a local Docker stack (the official WordPress image, MariaDB, wp-cli) on my laptop.
2. Search and replace for the URLs. Elementor stores some escaped as `https:\/\/`, so a normal replace misses them.
3. Then a preview on my own server with basic auth, `noindex` and outgoing mail turned off, so the client could click through it on her phone.

I took full page screenshots of all 21 pages, desktop and mobile, before and after, plus a small defect check script. If you host a preview behind Apache, [reverse proxy for Docker apps](/apache-reverse-proxy-docker-apps/) covers the plumbing.

## Round one: the obvious stuff

- **WebP.** A WebP converter plugin for the uploads, plus smaller mobile background images. Mobile page weight went from 5 to 13 MB per page down to around 2 MB.
- **Page cache.** WP Super Cache. Cached pages skip PHP, so security headers set in PHP vanish. I put them into `.htaccess` too.
- **Video only on click** instead of loading the player up front.

That alone isn't 90\. Elementor heroes are CSS background images, and the browser only finds them after parsing the CSS. With around 30 CSS and JS files from Elementor and plugins, the biggest image starts loading last.

## mu-plugins instead of theme edits

Everything else lives in `wp-content/mu-plugins/`. One file per topic, each with a header saying what it does. No theme edits, no Elementor edits, and updates can't overwrite it.

### Preload the hero per breakpoint

The plugin reads the first section's background images from `_elementor_data` and prints a preload per screen size:

```php
printf('<link rel="preload" as="image" href="%s" media="%s">' . "\n",
    esc_url($mobile), '(max-width: 767px)');
printf('<link rel="preload" as="image" href="%s" media="%s">' . "\n",
    esc_url($tablet ?: $desktop), '(min-width: 768px) and (max-width: 1024px)');
printf('<link rel="preload" as="image" href="%s" media="%s">' . "\n",
    esc_url($desktop), '(min-width: 1025px)');

```

The `media` attribute matters. Without it a phone downloads the desktop image too.

## Gotcha: fetchpriority="high" made it worse at first

In round one I added `fetchpriority="high"` to the preload. No gain. With 30 render blocking CSS files in the queue, the high priority image held up the CSS the page needs to paint anything. I took it out. In round two, once the small CSS files were inlined, high priority on the mobile preload helped. Same attribute, different result, depending on what else is in the queue.

### Font and first section

The extra CSS pulled a Google font in with `@import`, which is a chain of requests. I enqueue Elementor's local copy of the font as a normal stylesheet instead.

The first section had an Elementor entrance animation. On mobile the hero faded in after a delay, and that counts against LCP. I turned the animation off for the first section on mobile only, with CSS.

## Round two: what actually moved it

### Lazy load every image on hero pages

This was the big one. WordPress loads the first few content images eagerly and gives one of them high priority. On these pages the real hero is a CSS background, so those "first" images were three course pictures further down, about 360 KB, loading before the hero. Lighthouse counts everything that loads before the LCP.

Elementor caches widget HTML, so WordPress filters didn't catch it. An output buffer did:

```php
ob_start(function ($html) {
    return preg_replace_callback('#<img\b[^>]*>#i', function ($m) {
        $tag = $m[0];
        if (strpos($tag, 'custom-logo') !== false) return $tag;   // logo stays eager
        $tag = str_replace(' fetchpriority="high"', '', $tag);
        if (stripos($tag, 'loading=') === false)
            $tag = preg_replace('#^<img\b#i', '<img loading="lazy"', $tag);
        return $tag;
    }, $html);
});

```

Only on pages where the first section has a background image, and only for visitors.

### Inline small CSS, but only small

A `style_loader_tag` filter replaces `<link>` tags with the file contents for CSS files up to 20 KB, with relative `url()` paths rewritten. I tried a 60 KB limit first. Fewer requests, but Total Blocking Time went up, because the phone has to parse a much bigger HTML document. 20 KB was the sweet spot here.

### Less CSS and JS on pages that don't need it

- An addon plugin's CSS only on pages that actually contain one of its widgets (check `_elementor_data` for the widget type).
- Form and payment button CSS removed, the site doesn't use those blocks.
- Media player CSS only on pages with video or audio.
- jQuery moved to the footer.
- WordPress emoji script off.

All of this is skipped for logged in users and the Elementor editor.

## Gotcha: Elementor and the same image on mobile

One page sent the full original PNG to phones. Desktop and mobile had the same media item set, and in that case Elementor writes no mobile CSS rule at all. I added a page scoped rule that points phones to the 768 px version. I also re-encoded the mobile hero images to 560 px WebP. With Imagick the WebP quality setting was ignored on that server, with GD it worked.

## Tried and dropped

- **Autoptimize.** Installed on the preview, measured, removed again. No measurable gain, and combining Elementor's CSS is a risk I don't want on a client site.
- **Loading CSS async.** No gain.

What's left is Elementor's own pile of CSS and JS. More would need critical CSS, and I stopped at 92 to 93.

## The mobile bug after go-live

A day after go-live a phone screenshot came in: a photo on the training page cut off on the left. My first theory was a Safari animation issue. Wrong. The image widget had `margin-left: -200px` set in Elementor on all breakpoints. On desktop that's a nice overlap. On a phone it pushes the photo off screen.

I didn't touch the client's Elementor settings. A small mu-plugin, only on that page:

```css
@media (max-width: 1024px) {
  .elementor-123 .elementor-element.elementor-element-abc123 { margin-left: 0 !important; }
}

```

Then clear the page cache. Reproduce first, then fix.

## Go-live

Live was SFTP only, no shell. Backup first, then the preview's tables and files went over, with the old tables kept under a different prefix and the old files in a folder next to them. Rolling back means switching back, not restoring from a backup. The switch took about 20 seconds. For WordPress on your own box, [multiple PHP versions on one server](/multiple-php-versions-one-server/) and [KeyHelp as a free Plesk alternative](/keyhelp-free-plesk-alternative/) are how I run mine.

Nothing deleted, every change in its own file, every number measured three times.

---

### Related posts

- [Restoring a Site When the Files and the Database Are in Different Backups](https://blog.sudowl.com/restore-site-files-and-database-from-different-backups/)
- [Apache as a Reverse Proxy for Docker Apps (and the Panel Trap)](https://blog.sudowl.com/apache-reverse-proxy-docker-apps/)
- [Rebuilding My Ghost Blog After the Database Was Gone](https://blog.sudowl.com/ghost-blog-rebuild-after-database-loss/)