I am creating a dynamic page, in a WordPress environment. The page is created by a default standard WordPress page and then using shortcode. Combined with URL parameters in order to retrieve the necessary data.
The problem is, this page, including the URL parameters, is "shareable" to facebook and other social media. Thus the description that comes up is too generic. I assume this is because the default page, on which the shortcode resides, is also generic. That is what I want to change based on the data I am retrieving for display.
I have tried the code below and a few other variations, with no luck. In fact the filter is not even executed. Tried embedding the filter into an add_action call..the action call is done, but the filter remains executed.
add_filter('wp_title','ChangeTitle', 10, 2);
function ChangeTitle($title, $id)
{
if ( $title== 'Details' )
{
$BusinessName = $_GET['Name'];
return $BusinessName;
}
return $title;
}
Does anyone have a clever way to do this? part two of the question, would be how to assign a logo to the share.... but one thing at a time.