WordpressWordpress HooksWordpress TricksWp Tricks

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

Ajay Malhotra
the authorAjay Malhotra
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 2, Angular 6, Angular 7, Angular 8, Angular 9, Angular 10 Nodejs, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

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