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

By therichpost

Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

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.