Support » Fixing WordPress » How to use Post Tags for Meta Keywords

  • Is there any way I could reuse my Post Tags in Meta Keyword tag.

    I tried this but, it breaks my page layout.
    <meta name="keywords" content="<?php the_tags(); ?>

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • try get_the_tags() 😉 it works the same as the_tags() but without linking each tag…

    Thanks, I tried it but it did not display anything. It’s just empty.

    yep, you need to echo the name values from the array… i wrote you this code:

    <meta content="<?php
    if( is_singular() ) {
      $keywords = get_the_tags();
      if( $keywords ) {
        foreach($keywords as $keyword) {
          echo $keyword->name . ', ';
        }
      }
    }
    else {
      echo('your, custom, keywords, for, list, pages');
    }
    ?>" name="keywords" />
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to use Post Tags for Meta Keywords’ is closed to new replies.