R
R
Ruslan Askarov2019-08-02 13:55:06
Google
Ruslan Askarov, 2019-08-02 13:55:06

How to optimize a wordpress site?

the question is the following:
on the main page there is an insertion of a video from YouTube through an iframe. As a result, the gtmetrix test is very swearing that YouTube loads the script by almost 1mb. The site is made on WP, connected various plugins for lazy-load, etc. - anyway, this script is loaded and gtmetrix people are indignant at it. In google page speed, the first issue is to reduce the server response time. I suspect for the same reason. Please help me to solve this problem! Thank you in advance

Answer the question

In order to leave comments, you need to log in

7 answer(s)
V
Vladimir Druzhaev, 2019-08-06
@OtshelnikFm

I did this: the player made it up by itself (the picture has a large play button in the center). The picture from the YouTube video stretches. There are no scripts. By clicking on the play button, a modal window is launched - the video is played in it. Here after a clique all scripts also are loaded.
Why did I pull the picture from YouTube, and not from my server? This is how I check the availability of the video. It often happens that the copyright holders force them to remove the content and sometimes you go to the page - and the video is deleted. Thus, I automatically send a letter to my mail if the picture returned a 404 response to me. I just find a similar video on YouTube and replace the links (I'm talking about movie trailers)

G
Gennick's Macleo, 2019-08-02
@Genice

Save the video to your server.
Enable caching.

J
jamtuson, 2019-08-02
@jamtuson

Replace the iframe with an image, and remove the link from the iframe altogether.
As the site loads, hide the image and insert a link to the video in src (the link can be stored in data-attr)

A
Anatoly, 2019-08-02
@Tolly

Download the page completely, and then show the video!
Those. not just lazy, but with a delay until the document is fully loaded.

X
xmoonlight, 2019-08-02
@xmoonlight

1. Launching the video - only after the full loading of all page resources.
2. Use the Youtube API to fully control how the video is downloaded and played.

N
Nikolay Pekarsky, 2019-08-02
@Dizer7

It is necessary to connect caching and compression of scripts.
For example, you can use the following bundles of plugins (you need to test them and choose the most suitable one):
1) Clearfy PRO + WP Fastest Cache Premium
2) Clearfy PRO + WP Rocket + Rocket lazy load
3) Clearfy PRO + Autoptimize

A
Alexander Andryushkin, 2019-08-04
@alex-borisi

Load the iframe with a timeout, for example, after 3-4 seconds, before that you can show the picture. This time should be enough for the testers to complete their tests and give good results. We did the loading of scripts in this way, the content was loaded from user actions (scroll, cursor shift in the document area, click, touch) or simply loaded after 3 seconds. The method is not very good, but our site is completely on Ajax, so the solution was the best.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question