Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(is_category()){
- global $wp_query;
- if(isset($wp_query->posts) && !empty($wp_query->posts)) {
- $tags = array();
- foreach ($wp_query->posts as $post) {
- $posttags = get_the_tags($post->ID);
- if($posttags) {
- foreach ($posttags as $posttag) {
- $tags[] = $posttag->name;
- }
- }
- }
- if(!empty($tags)) {
- $tags = array_unique($tags);
- $tags = implode(',',$tags);
- echo '<meta name="keywords" content="' . $tags . '" />';
- }
- wp_reset_postdata();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement