What I’ve done is adding the below function to my theme functions.php file:
function append_jetpack_hashtags($ignorePostStatus = false) {
$mess_max_length = 118;
$strip_spaces = true;
$meta = '_wpas_mess';
$p = get_post();
if (empty($p)) return;
if (!$ignorePostStatus && $p->post_status === 'publish') return;
$mess = get_post_meta($p->ID, $meta, true);
if (empty($mess)) $mess = $p->post_title;
else {
if ($mess[0] == "#") {
$a = explode(" ", $mess);
$onlyHashtags = true;
foreach ($a as $w) {
if ($w[0] != "#") {
$onlyHashtags = false;
break;
}
}
if ($onlyHashtags) $mess = $p->post_title ." ". $mess;
}
}
if (!empty($mess) && !empty($mess_max_length) && $mess_max_length <= (strlen($mess))) return;
// Change to the list of hashtags you want to be displayed.
$ta = array( 'forex', 'trading' );
if (empty($ta)) return;
if (empty($mess)) $mess = '';
foreach ($ta as $t) {
// Create the hashtag, stripping spaces if needed.
$ht = '#' . (($strip_spaces) ? str_replace(' ', '', $t) : $t);
// only process newly-added hashtags, skipping duplicate ones
if (stripos($mess,$ht) === false) {
if (!empty($mess_max_length) && $mess_max_length <= (strlen($mess) + strlen($ht))) break;
$mess .= ' '.$ht;
}
}
update_post_meta($p->ID, $meta, $mess);
}
add_action('save_post', 'append_jetpack_hashtags', 99);
Change the below array to the hashtags you want to be displayed.
$ta = array( 'forex', 'trading' );
Or you can use this to automatically use the post tags as hashtags
$ta = wp_get_post_tags();
This does however, add the hashtags to every social media. But hey, nearly all social networks support hashtags, don’t they?
Although I changed it, credits to the original author of the code (I cannot find the original location).