Skip to content

Instantly share code, notes, and snippets.

@kevinruscoe
Created January 2, 2019 14:35
Show Gist options
  • Save kevinruscoe/b3c020ad484d87760833d16af7345805 to your computer and use it in GitHub Desktop.
Save kevinruscoe/b3c020ad484d87760833d16af7345805 to your computer and use it in GitHub Desktop.
<?php
// Assuming the field name is 'url'.
// Don't forget to URL encode
$url = sprintf("http://www.facebook.com/share/dialog/app_id=xxxxxx%s&redirecht_uri=myurl.com", get_field('url'));
// Or use http_build_query
$url = sprintf('http://www.facebook.com/share/dialog/%s', http_build_query([
'app_id' => 'xxxxxx',
'value_name' => get_field('url'),
'redirect_url' => 'myurl.com'
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment