SandyBites
SandyBites

Reputation: 173

Posts not reflecting correct preview when URL shared on Facebook

I have been on this for days now. Here's my problem:

When I share the URL's for my posts and some of my pages, it appends "Page Not Found" to the Title (og:title) and shows a random string for the Description (og:description). It works fine for most of my pages, but not for some and all of my posts.

Here is an example of a URL that is not working when shared on Facebook:

http://filminstitute.upd.edu.ph/event/saving-sally/?instance_id=207

Please take a look:

enter image description here

When posting the URL of a page that works, this is what it looks like and what is supposed to be happening:

enter image description here

When I run my URL's in the Facebook Share Debugger, here is what I been getting:

enter image description here

enter image description here

I initially believed that the problem could be solved by adding the following meta tags to the header of the Website like this:

<meta property="og:url" content="<?php get_permalink() ?>" />
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:type" content="website" />
<meta property="og:image" content="<?php get_header_image(); ?>" />
<meta property="og:description" content="UP Film Institute" />

But as you can see in the images I provided, the title and description meta have not responded to the tags in the header.

Other things I have tried:

  1. Changing the OG meta from the functions.php - nothing changed
  2. Installing Yoast SEO - nothing changed
  3. Performed a command line search on all the plugin files for code snippets that manipulate og:description - 1 instance found, commented out, nothing changed

Can anyone point me in the right direction regarding what to do with this? I have been working on this problem for days now.

I would greatly appreciate any help I can get.

Thank you very much in advance.

Upvotes: 1

Views: 337

Answers (3)

Ali_k
Ali_k

Reputation: 1661

Try changing the property in your header file from this:

<meta property="og:image" content="<?php get_header_image(); ?>" />

To this:

<meta property="og:image" content="<?php echo esc_url( get_header_image() ); ?>" />

Upvotes: 1

Aibrean
Aibrean

Reputation: 6422

The issue is not Facebook at all. It's DNS. When I was at home, I posted the following:

If you go to the page directly in your browser, "Page not found" is literally a part of the title (http://filminstitute.upd.edu.ph/screening-and-events) because the page doesn't exist. You need to use the correct URL (http://filminstitute.upd.edu.ph/screenings-and-events/) and then Facebook will resolve on its own. Typos are evil things ;)

Likewise, http://filminstitute.upd.edu.ph/event/saving-sally/?instance_id=207 doesn't go to a valid page. That looks like a permalink issue. I noticed the search on the site doesn't work either. Before trying to solve Facebook, I'd look into why you're getting a slew of 404s.

Otherwise, you're basically sharing the contents of your 404 page.

When I visited the website at work, the site looked COMPLETELY different and the links passed through fine. If the site DNS is breaking, then I'd bet on Facebook actually pulling the old one, and since those links may not have existed, that's why you're getting the 404 issues.

This is what I see at home:

what I saw at home

Upvotes: 1

Tristup
Tristup

Reputation: 3663

You sample url shows

<meta property="og:image" content="Array"/>

might be an issue with the printing the image url using your get_header_image function.

Upvotes: 1

Related Questions