Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add_my_meta() {
- if(is_single()) :
- $posttags = get_the_tags();
- if ($posttags) {
- $tag_names = '';
- foreach($posttags as $tag) {
- $tag_names .= $tag->name . ',';
- }
- ?>
- <meta name="keywords" content="<?php echo rtrim($tag_names, ','); ?>"/>
- <?php } ?>
- <meta name="description" content="<?php echo wp_strip_all_tags(get_the_excerpt(), true); ?>"/>
- <?php endif;
- }
- add_action('wp_head', 'add_my_meta');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement