1. Home
  2. /
  3. Web Design & Development
  4. /
  5. WordPress
  6. /
  7. How to Customize Yoast Meta Description for Custom Post Types or Your Pages and Posts?

How to Customize Yoast Meta Description for Custom Post Types or Your Pages and Posts?

How to customize Yoast Meta Description for custom post types?

I recently encountered a need to customize the meta descriptions for property detail pages. As there were many listings with constantly changing data, I needed a dynamic solution, such as a custom meta description template for the detail pages. The WordPress setup utilized the Yoast SEO plugin, a widely used and popular SEO plugin for WordPress. After reviewing the available documentation from Yoast, I discovered a feature that allows for customizing and adding custom variables, which can be replaced with values related to the property, such as its title, price, availability, phone number, etc. Let’s learn, how to customize Yoast meta description.

In this blog, you’re going to explore what meta description is, how to customize Yoast meta description and the importance of doing so.

What is Meta Description?

The meta description is an HTML attribute that provides a brief summary of the contents of a web page. It is typically displayed by search engines in the search results and serves to give users an idea of what the page is about. The meta description is not visible on the actual web page but can be seen in the HTML source code.

The meta description is an important factor in search engine optimization (SEO) as it can help improve the visibility and click-through rate of a website in search results. When creating meta descriptions, it is important to ensure they are concise, accurate, and relevant to the content of the page.

Here is an example how meta description looks on Google:

Examples of Meta Description

Related: Want to implement a contact us form in shopify?

How to Customize Yoast Meta Description

To customize the Yoast Meta Description for custom post types or pages and posts in WordPress, you can follow these steps:

  1. Install and activate the Yoast SEO plugin on your WordPress website.
  2. Create or edit the custom post type or page/post that you want to customize the meta description for.
  3. Scroll down to the Yoast SEO section and click on the “Edit snippet” button.
  4. In the Yoast SEO meta description field, enter a custom meta description that accurately reflects the content of your custom post type or page/post.
  5. Preview the snippet using the preview button and make sure it accurately summarizes your content and is the desired length.
  6. Publish or update the custom post type or page/post.

If you have not set a custom meta description, Yoast SEO will automatically generate one for you based on the content of your post.

Related: How to Use Custom Social Icons in a HubSpot Email Template?

Customize Yoast Meta Description for custom post types or your pages and posts

Here, you can learn how to apply codes:

1. Retrieving Custom Text for Meta Title, Description, and Keywords using a Method/Function

Create a method/function to retrieve your custom string or text that you would like to replace or show in the meta title, description, or keywords field.

function getSitePropertyTitle(){
     /*applying check to make queries or any actions only in the case of specific custom post types*/
     if ( 'listing' === get_post_type() ) {
            /*get your property title here*/
            return 'My custom new property title';

2. Use the Yoast SEO action to replace your custom variables

add_action('wpseo_register_extra_replacements', 'func_custom_yoast_variables');

3. Now, call the function you have specified in the action.

function func_custom_yoast_variables() {
       wpseo_register_var_replacement( '%%property_title%%', 'getSitePropertyTitle', 'advanced', 'Property title' );

Mention your custom variable, specify the callback function to retrieve the value.

And, last but the most important step. Add this custom variable in the Yoast configurations – Keywords, Title or Meta description fields.

In the above screenshot.. I have used 3 custom variables in the meta description field namely – %%property_title%%, %%property_status%% and %%property_agent_phone%%

So, you have to code your functions in a way to handle or replace these 3 variables.

Also, if you have noticed.. you can use these custom variables within your custom meta description statement.

Also read: How to Implement Infinite Pagination in WordPress?

Importance of Customizing Yoast Meta Description

Customizing the Yoast meta description is important for several reasons:

1. Improved Visibility

A well-written and relevant meta description can help your website stand out in search results and improve its visibility to potential visitors.

2. Increased Click-Through Rate

An appealing and descriptive meta description can encourage users to click on your website link in search results, leading to higher traffic and engagement.

3. Better Search Engine Optimization

A customized meta description is a key factor in search engine optimization (SEO) and can positively impact your website’s search ranking.

4. Branding and Representation

The meta description serves as a way to represent your brand and communicate the value of your website to potential visitors. Customizing it allows you to control the message and ensure it accurately represents your brand and content.

5. User Experience

A well-written meta description provides valuable information to users and helps them decide if your website is relevant to their search query, improving their overall user experience.

Hence, customizing the Yoast meta description is an effective way to improve your website’s search visibility, click-through rate, SEO, branding, and user experience.

Related: How to Implement Next and Previous Article Navigation Link With Title?


Customizing the Yoast meta description is a crucial aspect of search engine optimization (SEO) for custom post types and pages/posts in WordPress. By using the Yoast SEO plugin, you can easily create and manage custom meta descriptions for each of your pages and posts. This allows you to accurately summarize the contents of each page, improve visibility in search results, increase click-through rate, and provide a better user experience for your visitors.

With its simple and intuitive interface, customizing the Yoast meta description is a quick and straightforward process that can greatly benefit your website’s SEO and online presence.

Rate this post
Reviews & Ratings Get your stoe online with Shopify in 60 minutes Shop Now