Jump to content

In a custom WordPress page template, what PHP code can add meta description in the '<head>' section of all pages which are based on that template?


Recommended Posts


Add this to the template or, if you want it on all pages on the site, add it to functions.php

function rivendellweb_add_to_head(){ 
<meta name="description"  
content="This is an example of a meta description.  
This will often show up in search results."> 
add_action('wp_head', 'rivendellweb_add_to_head'); 
You may have to play with the opening and closing PHP tags to match your existing ones. The advantage of this is that you can add meta tags and other elements.

If you use an SEO plugin this may not be necessary


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...