Search code examples
phphtmllinkedin-api

How to change image on the post when shared offsite in php?


I have some job postings on my website, and for each Job Ad i want to share it on LinkedIn and Facebook. Up till here it works but there is a random image on that sharing. how can i change that?

I have used this

<a href="https://www.linkedin.com/sharing/share-offsite/?url=<?php echo (''.get_home_url().'/jobb/'.get_query_var('job_name'));?>" alt="linkedin"> Linked In </a>

but it shows this , see attched image.

enter image description here


Solution

  • I think you need to assign appropriate meta tags to your generated html file header. See more infos here: https://www.linkedin.com/advice/3/how-do-you-specify-images-media-social-sharing-html-skills-html

    The URL provided has also example for facebook.