Hello @eminecraft
I understand you programmatically create posts, but the breadcrumbs are inaccurate until you open the post and save it. Have you tried these steps:
- Install & activate the Yoast Test Helper plugin
- Go to Tools > Yoast Test
- Locate the Yoast SEO section and click on the ‘Reset indexables tables & migrations‘, ‘Reset Prominent words calculation‘, and ‘Reset Internal link counter‘ buttons. After each click, the page will reload to confirm that the specific reset was successful.
- Go to SEO > Tools, and under SEO data, click the “Start SEO data optimization” button to allow Yoast to rescan your content.
Please let us know if the reported issue remains after resetting the optimized data.
Thread Starter
Neo1337
(@eminecraft)
I installed a fresh version of WordPress and Yoast and tried to recreate the current bug. Also, I use the WordPress default category, Twenty Twenty-Three theme, and only the Yoast plugin installed.
Code used to create a post:
$post_id = wp_insert_post( array(
'post_type' => 'post',
'post_title' => 'random title',
'post_content' => '',
'post_status' => 'publish'
));
if ($post_id != 0) {
wp_set_object_terms($post_id, 'catname', 'category');
}
yoast_breadcrumb output:
Home » Uncategorized » random title
As you see, breadcrumb show Uncategorized, inside of catname taxonomy that is set.
In wp-admin on edit post page, catname value is correct set:

If I press the update button in wp-admin and go back to the post page, the correct breadcrumb is showing.
Home » catname » random title
Yoast Test Helper plugin is not helping here, as the bug is on a new fresh website, and you should send this to the developer team to lookup.
-
This reply was modified 2 years, 10 months ago by
Neo1337.
-
This reply was modified 2 years, 10 months ago by
Neo1337.
If you think this is a bug, we’re actively using the bug tracking on our GitHub repository, so your best next step would be to create a new issue for our developers here.
You will need an account to create a new issue. Please provide as much information about the issue, including the URL to this conversation. This guide will help you submit a complete report which may result in a faster resolution.