🛍 Spring Sale DISCOUNT! + 2x Benefits for FREE

Click Here!

How to Fix “Either ‘name’ or ‘item.name’ should be specified” Error

Sometimes, you might have noticed “Either ‘name’ or ‘item.name’ should be specified” error in Google Search Console. In this knowledgebase article, we’ll walk you through how to fix this error easily at your end.

This error is mainly related to Breadcrumb Schema and indicates that a name/item name in the Breadcrumb Schema could be missing. So if your post/category or any element in your Breadcrumb does not have a title, it is likely, you’ll be seeing this error.

You’ll see this error while testing Schema using Google’s Rich Result Testing tool or in your Google Search Console(when you’ve connected your website).

2 How Rank Math Deals With This Error

Rank Math has been built to handle scenarios where these errors would appear. Instead of adding an element to the Breadcrumbs Schema without item name, Rank Math simply ignores the missing element, altogether, hence you wouldn’t see this error in most cases.

But that said, if you leave the title of the post as well as the breadcrumb title blank, then Rank Math has got no data to add, and likely the case, where you would see this error.

Here are some solutions to get rid of this error.

3 Fix the Error With a Page Title

So if your post/page is missing a title, the easiest way to fix this error is to add one.

3.1 Open the Post/Page

Open the Post/Page that does not have a title by clicking the Edit option in the Post screen.

Edit posts without title

3.2 Add a Title

In the WordPress editor, enter a title for your post.

Add title for post in Gutenberg Editor

3.3 Update/Publish the Post

Once you’ve added the title, update the post, or in case, if this is a new post, simply publish it.

4 Fix the Error With a Breadcrumb Title

If for some reason, a title could not be added (like a custom post that does not use titles), then you can always add a Breadcrumb Title using the Advanced tab in Rank Math Meta Box. The Advanced tab in Rank Math is available only if you’re using the Advanced Mode of Rank Math.

4.1 Edit the Post/Page

To add a breadcrumb title, open the post/page with this error, by clicking the Edit option.

Edit the post or page without title

4.2 Open Rank Math in Gutenberg Sidebar

In the Gutenberg Editor, click the Rank Math SEO icon in the top-right corner of the screen. Alternatively, you can click the three vertical dots and choose Rank Math from the Plugins section.

Open Rank Math Meta Box in Gutenberg Editor

4.3 Navigate to the Advanced Tab

In the Rank Math Meta Box that appears on the screen, click the Advanced tab.

Navigate to the Advanced tab in Rank Math Meta Box

4.4 Add Breadcrumb Title

Under the Advanced tab, you will find the option to add Breadcrumb Title.

Add Breadcrumb title in Rank Math Meta Box

4.5 Update Your Post or Page

Once you’ve added the Breadcrumb Title, click the Update button. Or, if it is a new post, simply click Publish.

5 Using Code Snippet to Alter the Breadcrumb Title in Bulk

If you’ve numerous posts on your website, then practically adding title/breadcrumb title with the above methods will be more time-consuming and tedious. To get this rid of this error from posts in bulk, you can choose to use a filter that would allow changing the breadcrumb title.

5.1 Navigate to Theme File Editor

Navigate to WordPress Dashboard → Appearance → Theme File Editor (for Classic Theme) or WordPress Dashboard → Tools → Theme File Editor (for Block Theme).

Navigate toTheme File Editor from Appearances

Now from the list of files shown on the right side of the screen, choose rank-math.php.

Open rank-math.php in from Theme file Editor

5.2 Add Code Snippet

In the code editor available in the middle of the screen, enter the following code snippet. Make sure to replace “Example” in the below snippet with a title that is relevant to your website.

All the posts on your website that do not have a title would use this breadcrumb title. This filter adds the breadcrumb title dynamically on the front-end, and hence you wouldn’t find it in the Advanced tab of Rank Math’s Meta Box.

You can also extend this filter to use a post meta instead of the same title we’re using below.

/**
 * Filter Allow changing or removing the Breadcrumb items
 * Set a custom breadcrumb title if the post does not have any title
 *
 * @param array       $crumbs The crumbs array.
 * @param Breadcrumbs $this   Current breadcrumb object.
 */
add_filter(
	'rank_math/frontend/breadcrumb/items',
	function ( $crumbs, $class ) {
		// Check if we are viewing single posts and the posts have a title.
		if ( is_singular( 'post' ) && empty( trim( get_the_title() ) ) ) {
				$new_breadcrumb_title = 'Example'; // Change the title relevant to your site.
				// The last element in the $crumbs array is the post's
				// breadcrumb title, so we have to update it.
				$crumbs[ count( $crumbs ) - 1 ][0] = $new_breadcrumb_title;
		}
		// And return the breadcrumbs.
		return $crumbs;
	},
	10,
	2
);

5.3 Update File

Once you’ve added the code snippet, click the Update File button at the bottom of the screen to reflect the changes.

Add code snippet to set custom breadcrumb title in Rank Math

Now you can confirm if the error has been fixed by testing the page’s source code using Schema Testing looks like Google’s Rich Results Testing Tool.

And, that’s it! We hope the tutorial was helpful in fixing the error. If you’re still facing this issue, please feel free to reach our support team directly from here, and we’re always here to help.

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Learn more about the PRO Version

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles