[solved] HTTP/2 push for images - Wordpress and LSCache plugin activated

#1
Hello

On my Vitadesign.ch Wordpress website I do some CSS and JS push through the LSCache plugin.

Now I want to do it for images. so I tried the following for on image:
Code:
add_header link: "</wp-content/uploads/2018/05/farm-3358870_1920-d-lc-.jpg>; rel=preload";
But it is not pushed accroding to http://http2-push.io/.

Is there maybe another configuration to make on my websote so?

Any help?

Regards

Julien
 
Last edited by a moderator:
#2
Ok I noticed that then
Code:
add_header link: "</wp-content/uploads/2018/05/farm-3358870_1920-d-lc-.jpg>; rel=preload";
is visible on the website's display on top...


I tried to add these <?php ?> brackets, but when updating they disappear from the editor...
 
Last edited by a moderator:

Tishu

Well-Known Member
#3
Hello,

You can add this in to the header.php:
PHP:
<?php
  header("Link: </path to the image>; rel=preload; as=image", false);
?>
 
Last edited by a moderator:
#4
Thanks. I just added it but it does not work, here the whole head code:
PHP:
<head>
<?php astra_head_top(); ?>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">

<?php astra_head_bottom(); ?>
<?php wp_head(); ?>
</head>
<head>
<?php astra_head_top(); ?>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">

<?php astra_head_bottom(); ?>
<?php wp_head(); ?>


</head>

<?php astra_head_top(); ?>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">

<?php astra_head_bottom(); ?>
<?php wp_head(); ?>

<?php
header("Link: </wp-content/uploads/2018/05/farm-3358870_1920-d-lc-.jpg>; rel=preload; as=image", false);
?>

</head>


Regards
 
Last edited by a moderator:
Top