WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can we add # before each tag with both the_tags( ) and wp_tag_cloud( )?

share|improve this question
Note: We need this, because without a hash a tag is worthless.. :) – ialocin Jul 21 '15 at 15:59

Another very simple solution is to put this in your css file :

.tagcloud a:before {
  content: "#";
  font-color: #000;
share|improve this answer

You will have to use your own custom function, the_tags( ) doesn't allow you to do that. You could create a function like this, using get_the_tags, and format your html as you prefer :

function hashtags() {
    $posttags = get_the_tags();
    if ($posttags) {
        foreach($posttags as $tag) {
            echo '<a href="' . get_tag_link($tag->term_id) . '">#' . $tag->name . '</a> '; 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.