{"id":5045,"date":"2022-06-29T14:57:19","date_gmt":"2022-06-29T11:57:19","guid":{"rendered":"https:\/\/creativethemes.com\/blocksy\/?post_type=documentation&amp;p=5045"},"modified":"2022-06-29T14:57:19","modified_gmt":"2022-06-29T11:57:19","slug":"change-breadcrumb-items-programatically","status":"publish","type":"documentation","link":"https:\/\/creativethemes.com\/blocksy\/docs\/code-snippets\/change-breadcrumb-items-programatically\/","title":{"rendered":"Change breadcrumb items programatically"},"content":{"rendered":"\n<p>In some cases, you might want to forcefully change the breadcrumb items via code, to make them behave just the way you want them to. A simple example snippet is available below and it should let you modify where the breadcrumb items link to, and how they&#8217;re displayed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter(\n\t'blocksy:breadcrumbs:items-array',\n\tfunction ($items) {\n\t\tif (is_single()) {\n\t\t\t$items&#091;1]&#091;'url'] = 'https:\/\/url-to-blog.com';\n\t\t\t$items&#091;1]&#091;'name'] = __('Blog', 'blocksy');\n\t\t\t$items&#091;2]&#091;'name'] = get_the_title();\n\t\t\treturn $items;\n\t\t}\n\t\treturn $items;\n\t}\n);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In some cases, you might want to forcefully change the breadcrumb items via code, to make them behave just the way you want them to. A simple example snippet is available below and it should let you modify where the breadcrumb items link to, and how they&#8217;re displayed.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"doc_categories":[125],"class_list":["post-5045","documentation","type-documentation","status-publish","hentry","doc_categories-code-snippets"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"acf":[],"_links":{"self":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation\/5045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation"}],"about":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/types\/documentation"}],"author":[{"embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/comments?post=5045"}],"version-history":[{"count":0,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation\/5045\/revisions"}],"wp:attachment":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/media?parent=5045"}],"wp:term":[{"taxonomy":"doc_categories","embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/doc_categories?post=5045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}