Search code examples
phpfacebookfacebook-php-sdkfacebook-sharer

How to add a custom link when sharing post to facebook


enter image description here

Above is an example of a custom link added below the post in facebook. The "play" link src changes when you share it from different page of the third party website.

How to add a custom link using php? The name of link is it possible to have a different name? How many custom link can be added?

// edit: img link


Solution

  • You can add a custom link to the end of Like and Share by using the actions parameter. For example:

    $post = $facebook->api( "me/feed", "POST", array(
        'message' => 'Testing custom search action',
        'actions' => array(
            'name' => 'Search',
            'link' => 'http://www.google.com'
          )
      ) );
    
    print_r( $post );
    

    Will produce:

    enter image description here