• Resolved oguido

    (@oguido)


    Hello, I’m using insert_pages with a custom template on a page I’m having some trouble. From time to time, while editing the page the UPDATE button of wp editor gets stuck in “updating” and next to it it stays the message “saving” but nothing happens. I have to reload the page. Then I get this error:
    “There has been a critical error on this website. Please check your site admin email inbox for instructions.”
    The only way to be able to edit the page again is to disable insert_pages plugin. Once I do that I can go back to the page, update (save) the latest revision, and THEN activate insert_pages again. Only to have the same problem later on.
    The page has a lot of gutenberg blocks, but no plugin blocks apart from yours and wp_forms.
    This is the code of my custom template:

    <?php
    /**
     * Template Name: short excerpt
     */
    // Exit if accessed directly.
    defined( 'ABSPATH' ) || exit;
    
    while ( have_posts() ) : the_post();
    	echo edit_excerpt(get_the_excerpt(), 100);
    endwhile;
    
    function edit_excerpt($excerpt, $limit = 200) {
    	if ($limit > strlen($excerpt)) return $excerpt;
    	if (strpos($excerpt, '.') != true || strpos($excerpt, ',') != true) return $excerpt;
    	$excerpt = explode(' ', $excerpt);
    	$i = 0;
    	foreach ($excerpt as $key => $value) {
    		$i = $i + strlen($value);
    		if ($i >= $limit) {
    			if (strpos($value, '.') == true || strpos($value, ',') == true) {
    				return $return.substr($value, 0, -1).'...';
    			}
    		}
    		$return .= $value.' ';
    	}
    }
    ?>

    I don’t know if that’s the problem, or it’s coming from the plugin itself. I’m loading this template in 3 blocks in the page.
    I think I’ll manage to finish editing the page and hopefully it’ll be functional from then on, but I’m sending you this message to give you a heads up more than anything. I have the feeling it’s a conflict between insert_pages and the many gutenberg blocks that are in place around the page.
    Anyway, thank you very much and all the best!
    ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Paul Ryan

    (@figureone)

    So what was the specific error message that got emailed to you? (It should also be available in your web server’s error logs.)

    That will help track down the specifics! My guess is there is an artificially low memory_limit or timeout in PHP on your host, and your custom template code is taking too long to run updating all of the blocks and the web server is timing out.

    Thread Starter oguido

    (@oguido)

    Hello, thank you for your reply but I don’t have the email no more, I deleted ??
    anyway I worked around the issue so it’s not needed anymore. But thank you again! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘“There has been a critical error on this website”’ is closed to new replies.