Title: Conditional Meta Refresh
Last modified: August 24, 2016

---

# Conditional Meta Refresh

 *  [ecros](https://wordpress.org/support/users/ecros/)
 * (@ecros)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-meta-refresh/)
 * I need to know how to use the meta refresh tag in a conditional sense. I only
   want the homepage to auto refresh every 5 minutes, but none of the other pages.
 * I can get it to refresh everything by using the meta tag as it stands, but I 
   am having trouble making it work on only the homepage.
 *     ```
       <meta http-equiv="refresh" content="<?php if ( is_home() ) {
               single_post_title('', true);
           } else {
               bloginfo('name'); echo " - "; bloginfo('description');
           }
           ?>" />
       	<meta http-equiv="refresh" content="300" >
       ```
   
 * Any quick ideas?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [AJ Mallory](https://wordpress.org/support/users/jasonm4563/)
 * (@jasonm4563)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-meta-refresh/#post-6051677)
 * I would think you want the refresh meta tag inside your if statement before your
   else.
 * –AJ
 *  Thread Starter [ecros](https://wordpress.org/support/users/ecros/)
 * (@ecros)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-meta-refresh/#post-6051740)
 * Hi AJ, thanks and yes. I just don’t know how to write it correctly. I’m hoping
   someone smarter than me can help me figure it out.
 *  [AJ Mallory](https://wordpress.org/support/users/jasonm4563/)
 * (@jasonm4563)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-meta-refresh/#post-6051816)
 *     ```
       <meta http-equiv="refresh" content="<?php if ( is_home() ) {
               ?><meta http-equiv="refresh" content="300" ><?php
               single_post_title('', true);
           } else {
               bloginfo('name'); echo " - "; bloginfo('description');
           }
           ?>" />
       ```
   
 * Not sure what you have above this but the last line `?>" />`` makes me think 
   you are in the middle of some other html and if that’s that case this may not
   work.
 *  Thread Starter [ecros](https://wordpress.org/support/users/ecros/)
 * (@ecros)
 * [11 years ago](https://wordpress.org/support/topic/conditional-meta-refresh/#post-6051964)
 * I removed the trailing slash, but still no go. Anyone have a better way to do
   this?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Conditional Meta Refresh’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [ecros](https://wordpress.org/support/users/ecros/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/conditional-meta-refresh/#post-6051964)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
