Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support devnihil

    (@devnihil)

    @fernandot We checked on the page at https://educayaprende.com/post-sitemap1.xml and do see that this is generating a 500 error. ?This error is typically caused by that the resources required to generate the sitemap are not available or the request is timing out due to the resource restrictions of the server environment. We would first recommend ensuring that the PHP settings for both max_execution_time and memory_limit are set to a high enough value in the PHP environment. This setting is typically controlled by editing the values in a php.ini file such as in the following example:

    max_execution_time = 300
    memory_limit = 256M

    If you aren’t sure how to change these settings in php.ini, we would recommend contacting your hosting provider for additional assistance.

    If you are still receiving a 500 error after increasing both values for the PHP max_execution_time and memory_limit, the issue may be caused by that the PHP script run time restriction on the server is being reached. In order to reduce the amount of time necessary for the script to generate the sitemap, you can reduce the number of entries in the sitemap.

    By default, the number of entries in the sitemap is set to 1000 but by decreasing this value it will decrease the amount of resources required to generate the sitemap. To decrease the number of sitemap entries you can use the filter wpseo_sitemap_entries_per_page.

    For example, here is example code to limit the number of sitemap entries to 100:

    <?php
    /********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
    
    /* Limit the number of sitemap entries for Yoast SEO
     * Credit: Yoast Developers
     * Last Tested: Jan 31 2019 using Yoast SEO 9.5 on WordPress 5.0.3
     * Yoast SEO defaults to 1000
     * Google allows up to 50000 URLs or 50MB (uncompressed)
     */
    function max_entries_per_sitemap() {
        return 100;
    }
    
    add_filter( 'wpseo_sitemap_entries_per_page', 'max_entries_per_sitemap' );

    If you are not sure where it would go or how to add this code, we suggest working with a Yoast Partner here who can help.

    We also have more information on using this developer filter at the following link: https://yoast.com/help/xml-sitemaps-in-the-wordpress-seo-plugin/#limit

    Thread Starter Fernando Tellado

    (@fernandot)

    Thank you @devnihil

    Your function works ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress Critical Error in random post-sitemap pages’ is closed to new replies.