Title: meta description php code
Last modified: August 20, 2016

---

# meta description php code

 *  Resolved [jrcollins](https://wordpress.org/support/users/jrcollins/)
 * (@jrcollins)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/meta-description-php-code/)
 * I am using the following php code for my meta descriptions and it seems to be
   working ok except I added a manual excerpt for one of my posts and for that post
   the meta description is still a dynamically generated excerpt.
 *     ```
       <?php if (is_single()) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
               <meta name="description" content="<?php the_excerpt(); ?>" />
               <?php endwhile; endif; elseif(is_home()) : ?>
               <meta name="description" content="my meta description for my home page here" />
               <?php endif; ?>
       ```
   

The topic ‘meta description php code’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [jrcollins](https://wordpress.org/support/users/jrcollins/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/meta-description-php-code/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
