Automatically add hashtags to each Publicized post in WordPress

Many rely on Jetpack, as we find its modules, connections aside, are great. One of its key features being that it automatically post to your favorite networks.

But this module has its limitations. The first and most obvious is that you need to connect to to use, but once this option is saved is all Automattic asks for to access its virtues, wouldn’t it be great to automatically add related hashtags  ?

For example, if your post talks about WordPress, you can automate that whenever your posts are published related hashtags will automatically be added for greater dissemination of your content this by the way is used by many other network users social.

You can already do some automated customizations, but we can do much more.


Me refiero a automatizar totalmente, que no te tengas que acordar de personalizar los textos sino que se añada siempre algún hashtag – o varios – a tus publicaciones en redes sociales. Y para ello la mejor opción sería utilizar las etiquetas (tags) de la entrada como hashtag ¿a que sí?

Para ello recurriremos a nuestro plugin de utilidades, o al fichero functions.php de tu tema activo si lo prefieres, donde hay que añadir este código:


We can fully automate our Tweets, we can include hashtags to your posts on social networks. And for that the best option would be to use labels (tags) from our entry as hashtag.

We will draw our plugin utilities, or functions.php file of your current theme if you like, where you have to add this code:

To do so, add the following code to a functionality plugin:
function techhum_publicize_hashtags() {
    $post = get_post();
    if ( ! empty( $post ) ) {

        // Grab the tags of the post
        $post_tags = get_the_tags( $post->ID );

        // Append tags to custom message
        if ( ! empty( $post_tags ) ) {

            // Create list of tags with hashtags in front of them
            $hash_tags = ”;
            foreach( $post_tags as $tag ) {
                $hash_tags .= ‘ #’ . $tag->name;

            // Create our custom message
            $custom_message = get_the_title() . ‘ ‘ . $hash_tags;
            update_post_meta( $post->ID, ‘_wpas_mess’, $custom_message );

// Save that message
function techhum_cust_pub_message_save() {
    add_action( ‘save_post’, ‘techhum_publicize_hashtags’ );
add_action( ‘publish_post’, ‘techhum_cust_pub_message_save’ );