All Posts
Published: April 6, 2023
In simple terms, this code adds an automatic refresh feature to a website. When a user visits the webpage, the code tells the browser to refresh or reload the page every 30 seconds. This can be useful for displaying dynamic content or ensuring that users see the most up-to-date information without manually refreshing the page.
// Function to add the meta refresh tag
function add_meta_refresh() {
echo '<meta http-equiv="refresh" content="30">'; // Echo the meta tag with a refresh time of 30 seconds
}
// Hook the function to the wp_head action, which adds code to the head section of the webpage
add_action('wp_head', 'add_meta_refresh');