-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong og:url meta tag value #21430
Comments
Hi @smazur Thanks for using the Yoast SEO plugin. If you reset the Yoast indexables, will the og:url meta tag be updated after completing the reindex? More info about resetting the indexable at here: https://yoast.com/help/how-to-reset-yoast-indexables/ It seems like the issue you have noticed is due to this one: #15246, which was reported by other users before. However, our development team was not able to replicate it before. So, can you share more details on how to reproduce it with deeper steps on that issue to help us better replicate it and fix it? |
After reindexing the Here are the steps you can try to replicate this issue:
$p = new WC_Product_Simple();
$p->set_name( 'Test product' );
$p->set_status( 'publish' );
$p->set_category_ids([ PUT_YOUR_CATEGORY_TERM_ID_HERE ]);
$p->save();
This issue is also replicated when i create new product using following wp cli command:
|
Hi @smazur I tried the WP-CLI command and code but got some errors while checking both on my lab site. When I tried the WP-CLI Thanks in advance. |
On my setup wp cli command works without any error. Did you try the php code above? You can run it from |
I reproduced the issue with the following steps. Also confirmed that adding a post through WP CLI does not experience the same issue. Starting with a vanilla installation (category permalinks):
WordPress settingsPermalink: WooCommerce options:Setup path: Introduction Step 1: Which one of these best describes you? Step 2: Tell us a bit about your store Step 3: Get a boost with our free features Import Products |
Please give us a description of what happened
Hi! We have a WooCommerce store and use custom code to dynamically create products as follows:
Also we have rewrite rules setup that uses category slug and few other attributes in product url. When a new product is created i noticed that
og:url
meta tag has wrong product url.That's because
\Yoast\WP\SEO\Integrations\Watchers\Indexable_Post_Watcher::build_indexable
is hooked directly towp_insert_post
so the index record is created immediately after product post created and before any taxonomy attributes assigned to it. So it makesget_permalink
return wrong url for the product.I think this is a bug and
\Yoast\WP\SEO\Integrations\Watchers\Indexable_Post_Watcher::build_indexable
call should be defferred like you do in\Yoast\WP\SEO\Integrations\Watchers\Indexable_Post_Meta_Watcher::update_indexables
As a quick fix i used following snippet.
Looking forward for you reply. Thanks!
The text was updated successfully, but these errors were encountered: