How do I display a tag cloud under my post that only shows tags from that post?

First you need to get all the assigned tag id:s by calling wp_get_post_tags because the include parameter in wp_tag_cloud only works with tags id, Not page id. So when you have all the id:s put them in the include parameter within the wp_tag_cloud like this:

<?php
    // Get the assigned tag_id
    $tag_ids = wp_get_post_tags( $post->ID, array( 'fields' => 'ids' ) );

    // Check if there is any tag_ids, if print wp_tag_cloud
    if ( $tag_ids ) {

        wp_tag_cloud( array(
            'unit'     => 'px',       // font sizing choice (pt, em, px, etc)
            'include'  => $tag_ids,   // ID's of tags to include, displays none except these
        ) );
    }
?>

I have also removed some parameters that do nothing ancestry different than the defaults, you only need to add custom parameters if you need to modify the array.

Leave a Comment