How to add breadcrumb to Wordpress post with Yoast SEO

Official documentation: https://yoast.com/help/implement-wordpress-seo-breadcrumbs/

Requirement

Add breadcrumbs to single posts and category archive pages.

You can hand-code this or use a breadcrumb specific plugin but the site I'm working on already uses the Yoast SEO plugin for other purposes.

Solution

  1. Log into WP Admin
  2. SEO > Search Appearance > Breadcrumbs > configure as needed
  3. Open your site. If your theme supports Yoast SEO out of the box, the breadcrumb should appear. If not, add the code below where you want it to appear.
  4. If you have child categories and want a child category post breadcrumb to reflect the structure, make sure you set the child as "primary category" in the post.
    • Screenshot: setting the primary category of a WP post
    • Example: Home > Dog Profiles > Dachschunds > Loulou and Coco. Parent category = "Dog Profiles", child category = "Dachschunds". Set "Dachschunds" as the primary category in the post "Loulou and Coco"; otherwise "Dachschunds" won't be included in the breadcrumb.
<?php
// Add Yoast SEO breadcrumb
if (function_exists('yoast_breadcrumb')) yoast_breadcrumb('<p id="breadcrumbs">','</p>');
?>

In: Content Management Systems (CMS) MOC

Links to this note

  • Est ex deserunt esse ut pariatur quis fugiat id velit commodo

    Ut anim fugiat laboris et eiusmod aliquip.

  • Est ex deserunt esse ut pariatur quis fugiat id velit commodo

    Ut anim fugiat laboris et eiusmod aliquip.

  • Est ex deserunt esse ut pariatur quis fugiat id velit commodo

    Ut anim fugiat laboris et eiusmod aliquip.

  • Est ex deserunt esse ut pariatur quis fugiat id velit commodo

    Ut anim fugiat laboris et eiusmod aliquip.

  • Est ex deserunt esse ut pariatur quis fugiat id velit commodo

    Ut anim fugiat laboris et eiusmod aliquip.

  • Est ex deserunt esse ut pariatur quis fugiat id velit commodo

    Ut anim fugiat laboris et eiusmod aliquip.

  • Est ex deserunt esse ut pariatur quis fugiat id velit commodo

    Ut anim fugiat laboris et eiusmod aliquip.