{"id":102983,"date":"2022-05-04T09:05:00","date_gmt":"2022-05-04T14:05:00","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=resource&#038;p=102983"},"modified":"2024-10-02T17:02:38","modified_gmt":"2024-10-02T22:02:38","slug":"add-breadcrumbs-wordpress","status":"publish","type":"resource","link":"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/","title":{"rendered":"How to Add Breadcrumbs to Your WordPress Site"},"content":{"rendered":"\n<p>Navigation is a vital part of any website, and there is more than one way to provide it. The main menu on your website is the primary navigation tool that takes users to the content they want. However, it does not tell your customers where they currently are on your website.<\/p>\n\n\n\n<p>A breadcrumb menu is a secondary navigation system that tells your customers where they are in relation to your home page. This helps them navigate through the pages of your website with ease, and avoid getting lost.<\/p>\n\n\n\n<p>In this article, we will look into what breadcrumbs are and how they benefit your website. We\u2019ll then show you how to add breadcrumbs to your WordPress website. Let\u2019s get started!<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">What Are Breadcrumbs in WordPress?<\/h2>\n\n\n\n<p>Breadcrumbs is the term used to describe a hierarchical navigation menu. This kind of menu involves a trail of links, not unlike the breadcrumb trail left by Hansel and Gretel:<\/p>\n\n\n\n<p>Since many users do not enter your WordPress site through the home page, breadcrumb navigation helps them understand where they have landed. <a href=\"https:\/\/developers.google.com\/search\/docs\/data-types\/breadcrumb\" target=\"_blank\" rel=\"noreferrer noopener\">Search engines also use breadcrumbs<\/a> to better understand the hierarchy of your web pages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Benefits of Adding Breadcrumbs in WordPress<\/h2>\n\n\n\n<p>Adding WordPress breadcrumb menus to your website offers several benefits. Google loves breadcrumbs, for example, so this feature can improve <a href=\"https:\/\/wpengine.com\/resources\/the-ultimate-checklist-for-wordpress-on-page-seo\/\" target=\"_blank\" rel=\"noreferrer noopener\">your Search Engine Optimization (SEO)<\/a> and bring more visitors to your site.&nbsp;<\/p>\n\n\n\n<p>Breadcrumb menus can also reduce <a href=\"https:\/\/support.google.com\/analytics\/answer\/1009409?hl=en\" target=\"_blank\" rel=\"noreferrer noopener\">bounce rates<\/a>, because they improve your site\u2019s User Experience (UX). When users can navigate your website easily, they are more likely to spend time on it.&nbsp;&nbsp;&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Add Breadcrumbs in WordPress<\/h2>\n\n\n\n<p>You can add breadcrumbs to your WordPress website in two ways. The easiest method is to use a WordPress plugin, but you can also code breadcrumbs into your site\u2019s <em>header.php<\/em> file. Before you use either method, you should <a href=\"https:\/\/wpengine.com\/support\/restore\/\" target=\"_blank\" rel=\"noreferrer noopener\">create a backup of your website<\/a> just in case something goes wrong.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Method 1: Using a WordPress Plugin to add Breadcrumbs<\/h3>\n\n\n\n<p>The easiest way to add breadcrumbs to WordPress is with a breadcrumb plugin. There are many plugins you can use, including <a href=\"https:\/\/wordpress.org\/plugins\/breadcrumb-navxt\/\" target=\"_blank\" rel=\"noreferrer noopener\">Breadcrumb NavXT<\/a> and <a href=\"https:\/\/wordpress.org\/plugins\/wordpress-seo\/\" target=\"_blank\" rel=\"noreferrer noopener\">Yoast SEO<\/a>:<\/p>\n\n\n\n<p>Yoast SEO is often the best option, because it\u2019s likely a plugin that your website already uses.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1: Download the Yoast SEO Plugin<\/h4>\n\n\n\n<p>Since Yoast is an SEO plugin, it offers a wide range of functionality. That includes the creation and styling of breadcrumb navigation.<\/p>\n\n\n\n<p>To use this plugin, you will need to download it from the WordPress Plugin Directory. You can simply head to your site\u2019s <em>Plugins<\/em> page, search for \u201cYoast SEO\u201d, and <a href=\"https:\/\/wpengine.com\/resources\/wordpress-plugins\/\" target=\"_blank\" rel=\"noreferrer noopener\">install and activate the plugin<\/a> like any other.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2: Add a Function to Your <em>header.php<\/em> File<\/h4>\n\n\n\n<p>After the plugin is activated, you must add a function to your site\u2019s <em>header.php<\/em> file. To access this file, navigate to <em>Appearance<\/em> &gt; <em>Theme Editor<\/em> and select the file to open it.&nbsp;<\/p>\n\n\n\n<p>Then, add <a href=\"https:\/\/yoast.com\/help\/implement-wordpress-seo-breadcrumbs\/\" target=\"_blank\" rel=\"noreferrer noopener\">the following code<\/a> wherever you\u2019d like your breadcrumb setting menu to appear:<\/p>\n\n\n\n<p><code>&lt;?php<br>if ( function_exists('yoast_breadcrumb') ) {<br>&nbsp;&nbsp;yoast_breadcrumb( '&lt;\/p&gt;&lt;p id=\"breadcrumbs\"&gt;','&lt;\/p&gt;&lt;p&gt;' );<br>}<br>?&gt;<\/code><\/p>\n\n\n\n<p>In general, you\u2019ll want to place this code at the end of your <em>header.php<\/em> file. However, you can experiment with the menu\u2019s placement, checking the front end of your site to see how the result looks.<\/p>\n\n\n\n<p>You can even add the above function to your theme\u2019s <em>single.php<\/em> or <em>page.php<\/em> file instead, if you want to enable breadcrumb function to appear elsewhere on the page. Just make sure you only add it in one place.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3: Activate Breadcrumb Support<\/h4>\n\n\n\n<p>Finally, you will need to activate breadcrumb support. In Yoast SEO, this means navigating to <em>SEO<\/em> &gt; <em>Search Appearance<\/em> &gt; <em>Breadcrumbs<\/em>:&nbsp;<\/p>\n\n\n\n<p>Simply toggle the switch to \u201cEnabled\u201d, and you\u2019re good to go! Your WordPress breadcrumb menu will be set up and ready to use.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Method 2: Coding Your Own Breadcrumbs in WordPress<\/h3>\n\n\n\n<p>Adding website breadcrumbs can also be done manually through coding. If you do not want to use a breadcrumb plugin, you can add breadcrumbs without one. Before you attempt this, you may want to <a href=\"https:\/\/html.spec.whatwg.org\/multipage\/microdata.html\" target=\"_blank\" rel=\"noreferrer noopener\">read up on microdata<\/a>, in order to fully leverage the SEO potential of WordPress breadcrumbs.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1: Create a Skeleton Function<\/h4>\n\n\n\n<p>To add breadcrumbs to WordPress manually, you\u2019ll need to create a PHP function. The first step in creating this function is to build the skeleton. Your skeleton function will need a unique name, to avoid conflicts with other functions.<\/p>\n\n\n\n<p><code>function my_breadcrumbs() {<br> \/* Breadcrumbs code will go here *\/<br>}<\/code><\/p>\n\n\n\n<p>The above function is the skeleton, and the rest of the breadcrumbs code will be placed within the curly brackets.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2: Add Ground Rules<\/h4>\n\n\n\n<p>After creating the skeleton, you\u2019ll need to add rules to the function. The rules should be placed in the breadcrumb section:<\/p>\n\n\n\n<p><code>\/* Change according to your needs *\/<br>$show_on_homepage = 0;<br>$show_current = 1;<br>$delimiter = '\u00bb';<br>$home_url = 'Home';<br>$before_wrap = '&lt;span clas=\"current\"&gt;';<br>$after_wrap = '&lt;\/span&gt;';<br><br>\/* Don't change values below *\/<br>global $post;<br>$home_url = get_bloginfo( 'url' );<\/code><\/p>\n\n\n\n<p>The above rules generally use variables, so they can be changed later. The first two variables use booleans, where \u201c0\u201d is false and \u201c1\u201d is true.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3: Add the \u2018<em>if else<\/em>\u2019 Statement<\/h4>\n\n\n\n<p>Below the variables, you need to add an \u2018if else\u2019 statement. This statement will check to see if a user is on your website\u2019s home page or not. Based on this information, the statement will determine if the breadcrumbs are displayed or not:<\/p>\n\n\n\n<p><code>\/* Check for homepage first! *\/<br>if ( is_home() || is_front_page() ) {<br> $on_homepage = 1;<br>}<br>if ( 0 === $show_on_homepage &amp;&amp; 1 === $on_homepage ) return;<br><br>\/* Proceed with showing the breadcrumbs *\/<br>$breadcrumbs = '&lt;ol id=\"crumbs\" itemscope itemtype=\"http:\/\/schema.org\/BreadcrumbList\"&gt;';<br><br>$breadcrumbs .= '&lt;li itemprop=\"itemListElement\" itemtype=\"http:\/\/schema.org\/ListItem\"&gt;&lt;a target=\"_blank\" href=\"' . $home_url . '\"&gt;' . $home_url . '&lt;\/a&gt;&lt;\/li&gt;';<br><br>\/* Build breadcrumbs here *\/<br><br>$breadcrumbs .= '&lt;\/ol&gt;';<br>echo $breadcrumbs;<\/code><\/p>\n\n\n\n<p>If this statement is not added to the function, the breadcrumbs settings may or may not appear when you want them to.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 4: Add Function to Theme Header<\/h4>\n\n\n\n<p>Once your breadcrumbs function is complete, you can add it to your website\u2019s <em>header.php<\/em> file. Navigate to <em>Appearance<\/em> &gt; <em>Theme Editor<\/em> to open the file, and add the function to the very end.<\/p>\n\n\n\n<p>Then save your changes, and check out your new website breadcrumbs menu on the front end. You can continue to tweak the function and its placement until the menu looks just right (or disable breadcrumb when necessary).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Customize Your WordPress Site With WP Engine<\/h2>\n\n\n\n<p>Breadcrumb navigation menus help your site\u2019s visitors find their way. They also make it easier for search engines to understand the hierarchy of your website. A plugin like <a href=\"https:\/\/wordpress.org\/plugins\/wordpress-seo\/\" target=\"_blank\" rel=\"noreferrer noopener\">Yoast SEO<\/a> is the easiest way to add breadcrumbs to your website, but you can code them in manually as well.&nbsp;<\/p>\n\n\n\n<p>Using the right web host can help guarantee your website\u2019s performance, leaving you with time to focus on development and UX. WP Engine can offer you the best <a href=\"https:\/\/wpengine.com\/wordpress-hosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">hosting for WordPress<\/a>, and the best resources to create an incredible website experience!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Navigation is a vital part of any website, and there is more than one way to provide it. The main menu on your website is the primary navigation tool that takes users to the content they want. However, it does not tell your customers where they currently are on your website. A breadcrumb menu is<span class=\"tile__ellipses\">&hellip;<\/span><span class=\"tile__ellipses--animated\"><\/span><\/p>\n","protected":false},"author":1,"featured_media":122770,"template":"","resource-topic":[910],"resource-role":[895,896,1296,899],"resource-type":[916],"class_list":["post-102983","resource","type-resource","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Add Breadcrumbs to Your WordPress Site | WP Engine\u00ae<\/title>\n<meta name=\"description\" content=\"Using breadcrumbs in WordPress helps create a navigational structure for users on your site. Learn how to add breadcrumbs in WordPress with WP Engine.\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add Breadcrumbs to Your WordPress Site | WP Engine\u00ae\" \/>\n<meta property=\"og:description\" content=\"Using breadcrumbs in WordPress helps create a navigational structure for users on your site. Learn how to add breadcrumbs in WordPress with WP Engine.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-02T22:02:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2021\/10\/shutterstock_1520726849.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"627\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/\",\"url\":\"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/\",\"name\":\"How to Add Breadcrumbs to Your WordPress Site | WP Engine\u00ae\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\"},\"datePublished\":\"2022-05-04T14:05:00+00:00\",\"dateModified\":\"2024-10-02T22:02:38+00:00\",\"description\":\"Using breadcrumbs in WordPress helps create a navigational structure for users on your site. Learn how to add breadcrumbs in WordPress with WP Engine.\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/case-studies\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resources\",\"item\":\"https:\/\/wpengine.com\/case-studies\/resources\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Add Breadcrumbs to Your WordPress Site\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\",\"url\":\"https:\/\/wpengine.com\/case-studies\/\",\"name\":\"WP Engine\",\"description\":\"Managed Hosting for WordPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/f5301455463371a10d1fc290e9ad0085\",\"name\":\"WP Engine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"caption\":\"WP Engine\"},\"sameAs\":[\"https:\/\/wpengine.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Add Breadcrumbs to Your WordPress Site | WP Engine\u00ae","description":"Using breadcrumbs in WordPress helps create a navigational structure for users on your site. Learn how to add breadcrumbs in WordPress with WP Engine.","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"How to Add Breadcrumbs to Your WordPress Site | WP Engine\u00ae","og_description":"Using breadcrumbs in WordPress helps create a navigational structure for users on your site. Learn how to add breadcrumbs in WordPress with WP Engine.","og_url":"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/","og_site_name":"WP Engine","article_publisher":"https:\/\/www.facebook.com\/wpengine","article_modified_time":"2024-10-02T22:02:38+00:00","og_image":[{"width":1200,"height":627,"url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2021\/10\/shutterstock_1520726849.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/","url":"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/","name":"How to Add Breadcrumbs to Your WordPress Site | WP Engine\u00ae","isPartOf":{"@id":"https:\/\/wpengine.com\/case-studies\/#website"},"datePublished":"2022-05-04T14:05:00+00:00","dateModified":"2024-10-02T22:02:38+00:00","description":"Using breadcrumbs in WordPress helps create a navigational structure for users on your site. Learn how to add breadcrumbs in WordPress with WP Engine.","breadcrumb":{"@id":"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/case-studies\/resources\/add-breadcrumbs-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/case-studies\/"},{"@type":"ListItem","position":2,"name":"Resources","item":"https:\/\/wpengine.com\/case-studies\/resources\/"},{"@type":"ListItem","position":3,"name":"How to Add Breadcrumbs to Your WordPress Site"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/case-studies\/#website","url":"https:\/\/wpengine.com\/case-studies\/","name":"WP Engine","description":"Managed Hosting for WordPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/f5301455463371a10d1fc290e9ad0085","name":"WP Engine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","caption":"WP Engine"},"sameAs":["https:\/\/wpengine.com"]}]}},"acf":[],"grid_image_url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2020\/04\/shutterstock_141884731.jpg","media-type":{"term_id":916,"name":"Article","slug":"article"},"role":"<strong>Roles:<\/strong> Agency, Developer, Publisher, Site Owner","topic":"<strong>Topics:<\/strong> SEO","_links":{"self":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource\/102983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource"}],"about":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/types\/resource"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/users\/1"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media\/122770"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media?parent=102983"}],"wp:term":[{"taxonomy":"resource-topic","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-topic?post=102983"},{"taxonomy":"resource-role","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-role?post=102983"},{"taxonomy":"resource-type","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-type?post=102983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}