SmartCrawl Pro intermittent fatal error with Sitemap generation from cron

I did live chat before on this issue and it came up again. On one of my sites running in a multisite I get this error that happens at random with sitemap generation, rendering the website and its wp-admin area completely unusable to the point I have to network deactivate it.
Fatal error: Uncaught Error: Call to a member function get_page_permastruct() on null in /home/user/public_html/wp-includes/link-template.php:357 Stack trace: #0 /home/user/public_html/wp-includes/link-template.php(320): _get_page_link(Object(WP_Post), false, false) #1 /home/user/public_html/wp-includes/link-template.php(144): get_page_link(Object(WP_Post), false, false) #2 /home/user/public_html/wp-content/plugins/wpmu-dev-seo/includes/tools/sitemaps.php(440): get_permalink(Object(WP_Post)) #3 /home/user/public_html/wp-content/plugins/wpmu-dev-seo/includes/tools/sitemaps.php(283): WDS_XML_Sitemap->_load_post_items() #4 /home/user/public_html/wp-content/plugins/wpmu-dev-seo/includes/tools/sitemaps.php(51): WDS_XML_Sitemap->_load_all_items() #5 /home/user/public_html/wp-content/plugins/wpmu-dev-seo/includes/tools/sitemaps.php(35): WDS_XML_Sitemap->generate_sitemap() #6 /home/user/public_html/wp-content/plugins/wpmu-dev-seo/includes/core in /home/user/public_html/wp-includes/link-template.php on line 357

The problem goes away from network deactivate, then I can activate it again. I can manually generate the sitemap and all works fine for a while.

This only happens to one of the sites, not all of them. Even for that site, I deactivated all plugins but it only went away when I disable SmartCrawl. I have a cron set to run wp-cron every hour.

Any help / fix would be appreciated, thanks.

EDIT:

Last time it worked from deactivating and activating SmartCrawl Pro, this time however, the error came back as soon as it was activated again.

  • Majid
    • Syntax Hero

    Hello Cave Consulting
    I hope you are doing great today :slight_smile:

    Would you please email us the following information so we can debug the issue further ?
    Secure contact form https://premium.wpmudev.org/contact/#i-have-a-different-question .

    Subject: "Attn: Majid Hamdani"

    - Mark to my attention, the subject line should contain only: ATTN: Majid Hamdani
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - login URL and admin account login credentials (may be a temporary admin account) data
    - Include FTP log-in details (hostname, username & password)
    - Include hosting control panel access details (login address, username & password)
    -- cPanel's usually the control panel used for this, but your provider may use something else; I'll need this for accessing your site's database, preferably via phpMyAdmin
    - Include any relevant URLs for your site

    Thanks,
    Majid

  • Cave Consulting
    • Google Cloud Partner

    Hi Majid,

    The email has been sent. I did some T/S this morning, I was able to turn it on without the same error for that website but it turned all the pages' titles to "Contact Form" which is not any page title but a name for one of the Contact Form 7 forms. I was also unable to access SmartCrawl from that website where it is experiencing those issues. Hope this helps add to that email I sent.

  • Majid
    • Syntax Hero

    Hello Cave Consulting
    Thank you for sending the credentials, that was helpful :slight_smile:

    First I logged in the subsite after enabling SmartCrawl sitewide function, and I was able to see the sitemap generated and also the ability to to access SmartCrawl settings from that subsite https://www.texas******off.com/

    But since you mentioned the issue happens when the crons run which is happening every hour, I have enabled the debug logs to catch any errors that might appear.

    Let me know when you notice the issue so I can check the logs and see if there is any extra info that we can extract from there :slight_smile:

    Thanks,
    Majid

  • Cave Consulting
    • Google Cloud Partner

    Hey guys,

    It did happen again on the same site, this time without errors and just gave the WordPress the white screen of death. Could you look into this again? Thanks.

    I have the WP logs but couldn't find anything in relation to the problem, mostly just notices. I can send you a gzip version if you'd like since the log file is over 1GB.

  • Dimitris
    • Support Star

    Hey there Cave Consulting ,

    hope you're doing good! :slight_smile:

    Could you please access your server via FTP, edit the wp-config.php file, find a line like
    define('WP_DEBUG', false);and replace it with the following (if the above line doesn’t exist, simply insert next snippet just above the /* That's all, stop editing! Happy blogging. */ comment)

    // Enable WP_DEBUG mode
    define('WP_DEBUG', true);
    // Enable Debug logging to the /wp-content/debug.log file
    define('WP_DEBUG_LOG', true);
    // Disable display of errors and warnings
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);

    Then go ahead and try to replicate the error. That means that you should activate SmartCrawl, set a schedule and wait for next crawl cycle.
    By doing so, a /wp-content/debug.log file should be created. Simply download it, rename it to debug.txt and attach it here in your next reply. If size of text file exceeds the 5MB limit of our blog, please use a service like Dropbox and post the shareable link instead.
    Ref: https://premium.wpmudev.org/blog/debugging-wordpress-how-to-use-wp_debug/

    Warm regards,
    Dimitris

  • Ivan
    • Developer

    Hi Cave Consulting !

    It seems it's a bug in the plugin. I've added this line into {wordpress_folder}/wp-content/plugins/wpmu-dev-seo/includes/tools/class_wds_schema_printer.php file, to the get_site_schema_data function, via FTP the following line
    if ( ! class_exists( 'Smartcrawl_OnPage' ) ) { require_once( SMARTCRAWL_PLUGIN_DIR . '/tools/onpage.php' ); }
    before this one (approximately line 206)
    $keywords = Smartcrawl_OnPage::get()->get_keywords( Smartcrawl_Endpoint_Resolver::L_BLOG_HOME );
    So, it should help with this issue. If it will create another issue - please, provide us your debug.log again.
    Note: I'll implement this change to the next versions of the plugin too.

    Best,
    Ivan.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.