• I’m trying to write a little bit of code so that the tags on my blog can be used as keywords in the <meta> part of the <head> on my site.

    So far, so good, I have:

    <?php echo '<meta name="keywords" content="';
    $posttags = get_terms('post_tag');
    if ($posttags) {
    foreach($posttags as $tag) {
    echo $tag->name;
    echo ", "; }
    echo '" />'; } ?>

    which works really well.

    However, I don’t want my site to be penalised by search engines for having too many keywords, so I want to limit the amount of tags I show to maybe the 15 most popular.

    So, does anyone know how I can do this by adding to the code above? Or another way? (I am actually testing in 2.7 RC1, if that helps!)

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using tags as meta keywords (PHP question)’ is closed to new replies.