Facebook share / scheduled posts (1 post)

  1. Klark0
    Posted 4 years ago #

    Since the beginning of the year I noticed that Facebook share on scheduled posts that were now published, were coming as 404s in the facebook pop up.

    It worked fine a while before that, so i guess Facebook's crawler now pre-fetches any page with the share/like buttons, whereas previously it would only crawl on the first share/like.

    This is only a problem if you use scheduled posts extensively and you preview your posts on your pages before they go live.

    So to fix:

    Wrap your facebook code like so:

    <?php $p_status = get_post_status( $post );
                if ($p_status == 'publish') : ?>
    <fb:share-button href="<?php the_permalink() ?>" type="button_count"></fb:share-button>
          <?php else: echo '';
                endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by Klark0
  • This topic is not a support question
  • WordPress version: 3.0.4


No tags yet.