• Resolved billb101

    (@billb101)


    I’m trying out the plugin “Gutenberg Blocks – PublishPress Blocks Gutenberg Editor Plugin” and when I view any Page in my WordPress site (specifically a site within a multi-site), I get the following errors:

    
    Warning: count(): Parameter must be an array or an object that implements Countable in /PATH/TO/wp-includes/post-template.php on line 321
    
    Notice: Trying to access array offset on value of type null in /PATH/TO/wp-includes/post-template.php on line 327

    Any suggestions?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    Hi @billb101

    Thanks for using PublishPress Blocks.

    Just to confirm, the issue disappear if you deactivate PubilshPress Blocks?

    Thanks,

    Thread Starter billb101

    (@billb101)

    Yes, it only shows up when I have the plugin installed. It appears that the array element

    $elements['pages']

    is null and that is generating the error in both cases I think. To determine this, with the plugin installed and activated I made the following changes to

    wp-includes/post-template.php

    First off I added a print_r statement above line 321, i.e., I changed

    
    if ( $elements['page'] > count( $elements['pages'] ) ) {
         // Give them the highest numbered page that DOES exist.
         $elements['page'] = count( $elements['pages'] );
    }

    to

    echo '<pre>'.print_r($elements, true).'</pre>';
    if ( $elements['page'] > count( $elements['pages'] ) ) {
         // Give them the highest numbered page that DOES exist.
         $elements['page'] = count( $elements['pages'] );
    }

    and got the following output

    Array
    (
        [page] => 
        [more] => 1
        [preview] => 
        [pages] => 
        [multipage] => 
    )

    And for the other error I added a print_r above line 327, i.e., I changed

    
    $content = $elements['pages'][ $page_no - 1 ];

    to

    echo '<pre>'.print_r($elements, true).'</pre>';
    $content = $elements['pages'][ $page_no - 1 ];

    and got the following output

    Array
    (
        [page] => 
        [more] => 1
        [preview] => 
        [pages] => 
        [multipage] => 
    )

    My WordPress multisite works fine otherwise and does not generate these errors unless I install and activate the aforementioned plugin. Thank you for your help!

    Plugin Author htmgarcia

    (@htmgarcia)

    Hi @billb101,
    which WordPress, PHP and PublishPress Blocks versions are you using?

    Regards

    Thread Starter billb101

    (@billb101)

    PHP Version: 7.4.33

    WordPress Version: 6.2.2 (WordPress Multisite, folder based)

    PublishPress Blocks Version: 3.1.5

    Plugin Author htmgarcia

    (@htmgarcia)

    Thanks @billb101 !

    I’m not able to reproduce the issue. To check if the theme is somehow involved too, may you keep PublishPress Blocks active, and use a different theme like Twenty Twenty-One for a minute and see if the issue is gone?

    Looking forward to help you

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    @billb101 Have you had a chance to check our dev suggestion above?

    Thread Starter billb101

    (@billb101)

    @rizaardiyanto Sorry for not responding sooner. I did try a the Theme Twenty Twenty-One and the problem disappeared. The problem happens with my Theme which is a custom Theme I wrote that uses ACF Pro and Timber. This is the first time I’ve had a problem with a plugin due to my Theme. Suggestions?

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    @billb101 We will not be able to give relevant suggestions without doing proper troubleshooting.

    Unfortunately, as the issues related custom theme, we will not be able to do troubleshoot there.

    We suggest you to check with dedicated developer in case there is something wrong with the custom theme.

    Thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Parameter must be an array and access array offset errors’ is closed to new replies.