Function: aioseo_breadcrumbs()

You can use this code snippet in your child theme to render the breadcrumb trail for the current page:

<?php if( function_exists( 'aioseo_breadcrumbs' ) ) aioseo_breadcrumbs(); ?>

The aioseo_breadcrumbs() function needs to run after the queried object (post, term or archive) has been loaded; otherwise All in One SEO is not able to determine the context of the current page. If the function is called before the object is loaded, nothing will be rendered.

The filter mentioned above can be added in single.php, header.php, or any other theme template file. If you’re not sure where to add the filter, we recommend getting in touch with your theme provider, as the placement of certain codes may vary by theme.

Exclude your homepage from showing breadcrumbs

If you wish to exclude your homepage from showing breadcrumbs, you may use the filter code below on your WordPress site instead of applying the code above:

<?php if( function_exists( 'aioseo_breadcrumbs' ) && ( !is_home() ) ) aioseo_breadcrumbs(); ?>

If the code above doesn’t work for your homepage, you can try the code below instead:

<?php if( function_exists( 'aioseo_breadcrumbs' ) && ( !is_home() && !is_front_page() ) ) aioseo_breadcrumbs(); ?>

Code Example

The code snippet below illustrates how you can use the aioseo_breadcrumbs() function in your theme. In this example, the breadcrumb trail is rendered right above the site header.

<!doctype html>
<html <?php language_attributes(); ?> <?php twentytwentyone_the_html_classes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div id="page" class="site">
	<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'twentytwentyone' ); ?></a>

	<?php
		if ( function_exists( 'aioseo_breadcrumbs' ) ) aioseo_breadcrumbs(); 
		get_template_part( 'template-parts/header/site-header' );
	?>

	<div id="content" class="site-content">
		<div id="primary" class="content-area">
			<main id="main" class="site-main" role="main">

There is no legacy documentation for this as it was added in All in One SEO v4.1.1.