I want to include in my WordPress page mydomain.com/plan which is page_id = 25 :
<link rel="prefetch" href="/plan-both/ " as="document">
<link rel="prefetch" href="/plan-strategy/ " as="document">
<link rel="prefetch" href="/plan-funding/ " as="document">
According to this we need to include it in the header.php file :
<?php if(is_page(25)) { ?>
<link rel="prefetch" href="/plan-both/ " as="document">
<?php } ?>
Question : Would pre-fetching still work if I included in the body of the page ?
So that I can include this within the WordPress page rather than editing the header.php file.
Yes, prefetching will still work.
It will also improve the page loading performance a little bit because prefetching will start already halfway into the loading of the page if it is in the head.
Moving it to the bottom of the , it will only start after all the important stuff is done.