• I updated URLs for SEO purposes and had to create a custom field to store the old URL in which I could use later as the URL I wanted FB to recognize so that my FB likes wouldn’t disappear.

    In the FB code, I can simply put:

    <div class="fb-like" data-href="<?php sharingurl(); ?>" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></div>

    where sharingurl() is a function* in my functions.php:

    function sharingurl () {
    	if(get_field('old_url') == "")
    		{
    			echo untrailingslashit(get_permalink());
    		} else {
    			echo get_field('old_url');
    		}
    }

    * I was already using the Advanced Custom Fields plugin so I used it here to create the custom field “old_url”.

    How can I change your code to accommodate this? Any hints?

    http://wordpress.org/plugins/bj-facebook-popular-posts/

  • The topic ‘Telling FB to use a different URL to fetch shares/likes’ is closed to new replies.