• Resolved benbluef

    (@benbluef)


    Yoast breadcrumbs are not working properly on WooCommerce product pages. I want to display the category hierarchy.

    On some product pages, there are database errors like this:

    WordPress database error: [Column 'ancestor_id' cannot be null]
    INSERT INTO <code>wp_yoast_indexable_hierarchy</code> (<code>indexable_id</code>, <code>ancestor_id</code>, <code>depth</code>, <code>blog_id</code>) VALUES ('1', NULL, '1', '1')

    (that table is empty)

    The product permalinks are set as: /hire/%product_cat%/

    I’ve tried using Yoast Test Helper to reset the tables but it made no difference.
    In SEO > Search Appearance > Breadcrumbs “Taxonomy to show in breadcrumbs for content types” is set to “Category” for “Products”.

    When editing a product, the product is assigned each category in it’s hierarchy with the grandchild category set as the primary.

    THanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello,

    Thanks for reaching out.

    Can you confirm if you have WordPress 5.6 and Yoast SEO 15.6? Also, are all of your other non-Yoast plugins and themes are updated? Could you also check if your site meets the necessary plugin requirements?

    Furthermore, you mentioned that installing the Yoast Test Helper plugin and resetting the indexables did not make a difference. We are sorry about this. Could you check if there isn’t anything preventing Yoast SEO from creating the tables in the database as per this article here — https://yoast.com/help/cannot-create-database-tables/?

    Thread Starter benbluef

    (@benbluef)

    Yes tried with WordPress 5.6 and Yoast SEO 15.6.2

    The database tables are there.

    I’m testing locally and using the root database user.

    Plugin Support devnihil

    (@devnihil)

    @benbluef Thanks for your reply. Judging by the error, it does appear that the value for ancestor_id is missing.

    Is this affecting all of the WooCommerce product pages, or only specific ones?

    Also, when does the error appear? Is it when you go to the edit page for that product immediately, or does it occur when you try updating/publishing changes?

    We know that you already tried resetting the tables with the Yoast Test Helper plugin, but after that are you able to perform the “Start SEO Data Optimization” function and run it successfully?

    Thread Starter benbluef

    (@benbluef)

    The error appears at the top of the page when viewing some single product pages.

    I cannot start SEO Data Optimization as the website is not in production mode.

    Actually I also tried starting over by deactivating Yoast and deleting it and manually deleting all of the wp_yoast database tables but now when I reinstall the plugin it doesn’t create the tables.

    Thread Starter benbluef

    (@benbluef)

    I exported the table structure (15.6.2) from another site and used that to recreate the tables.

    However still getting the same problem!

    The error message appears on the product page after saving the product in the admin.
    And the breadcrumbs don’t always include the category hierarchy, even thought the URL does e.g.

    website.local/hire/lighting/festoon-lights/festoon-dimmer-hire/

    Plugin Support devnihil

    (@devnihil)

    @benbluef Thanks for your reply and for the additional information. We’re sorry to hear you are still experiencing this issue on your site.

    Can you please confirm you are using the most recent update of Yoast SEO that was released, version 15.6.2? You can learn more about updating here: https://yoast.com/help/how-can-i-update-my-free-plugin/

    In addition, are you able to run a database check to see whether there are any issues with crashed tables, and if so run a repair on the database?

    Also, Yoast SEO requires the following permissions for the relevant database user to create the relevant database tables:

    – ALTER
    – CREATE
    – DELETE
    – INDEX
    – INSERT
    – SELECT
    – UPDATE
    – DROP

    Please make sure that the current database user has all the necessary permission for your site. If you are unsure about this, your web hosting provider would be the best place to assist you on this.

    If after ensuring that both WordPress, Yoast SEO, and your other plugins and themes are up to date the errpr is still occurring, we’d next recommend performing a conflicting check to see whether another plugin or theme is interfering with the Yoast SEO Plugin. This will help us narrow down the exact cause and determine what the next steps are while saving you time.

    The fastest way to do this is to?deactivate all non-Yoast plugins and switch to a standard theme?like?Twenty Nineteen.?Test this on your development or staging site, if you have one. If not, we recommend using the?Health Check & Troubleshooting?plugin. This plugin allows you to run a conflict check?without affecting normal visitors to your site.

    If you’re unfamiliar with checking for conflicts, we’d like to point you to a step-by-step guide that will walk you through the process:?How to check for plugin conflicts.

    Thread Starter benbluef

    (@benbluef)

    I’m using Yoast 15.6.2

    The website is on my local development machine so I’m using the root database user that has all permissions.

    I changed theme to TwentyTwentyOne but still getting the same error (even when not using the yoast_breadcrumbs() function).

    Sometimes constantly re-saving the category and constantly re-saving the product makes the breadcrumbs work for that product.

    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    Thanks for your confirmation. We are sorry to hear that you’re still experiencing the issue.

    The issue you are currently experiencing here is occurring due to the ancestor_id that is missing from the Yoast SEO Indexables tables and migrations and we believe running the SEO data optimization would fix the issue for you.

    However, we know that you cannot run the SEO data optimization as you are currently running the site in a local environment. In this case, can you please define the environment variable to production so that you can run the SEO data optimization to see whether this resolves the issue for you?

    Example: define( 'WP_ENVIRONMENT_TYPE', 'production' );

    You can find more information about the WordPress environment variable here here. Let us know whether the issue persists after performing the above.

    Thread Starter benbluef

    (@benbluef)

    I think that’s fixed it, thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘ancestor_id cannot be null’ is closed to new replies.