How to add custom meta title and meta description in WordPress?

How to add custom meta title and meta description in Wordpress?

Hello to all, welcome to therichpost.com. In this post, I will tell you, How to add custom meta title and meta description in WordPress?

Post Working:

In this post, I am sharing wordpress hook, that will add custom meta title and meta description. I am doing this for my selected wordpress archive.

Here is the wordpress hook and you need to add this into your theme’s functions.php file:

add_filter('wpseo_metadesc','custom_meta');
function custom_meta( $desc ){

if (is_post_type_archive('books')) {
$desc = "This is custom description.";
}

return $desc;
}
add_filter('wpseo_title','custom_title');
function custom_title( $title ){

if (is_post_type_archive('books')) {
$title = "This is custom title.";
}

return $title;
}

 

If you have any kind of query then please let me know or comment below.

jassa

Thank you

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.