Title: Parameter must be an array and access array offset errors
Last modified: August 2, 2023

---

# Parameter must be an array and access array offset errors

 *  Resolved [billb101](https://wordpress.org/support/users/billb101/)
 * (@billb101)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/)
 * 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:
 *     ```wp-block-code
       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](https://wordpress.org/support/users/rizaardiyanto/)
 * (@rizaardiyanto)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16942920)
 * Hi [@billb101](https://wordpress.org/support/users/billb101/)
 * Thanks for using PublishPress Blocks.
 * Just to confirm, the issue disappear if you deactivate PubilshPress Blocks?
 * Thanks,
 *  Thread Starter [billb101](https://wordpress.org/support/users/billb101/)
 * (@billb101)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16945401)
 * Yes, it only shows up when I have the plugin installed. It appears that the array
   element
 *     ```wp-block-code
       $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-block-code
       wp-includes/post-template.php
       ```
   
 * First off I added a print_r statement above line 321, i.e., I changed
 *     ```wp-block-code
       if ( $elements['page'] > count( $elements['pages'] ) ) {
            // Give them the highest numbered page that DOES exist.
            $elements['page'] = count( $elements['pages'] );
       }
       ```
   
 * to
 *     ```wp-block-code
       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
 *     ```wp-block-code
       Array
       (
           [page] => 
           [more] => 1
           [preview] => 
           [pages] => 
           [multipage] => 
       )
       ```
   
 * And for the other error I added a print_r above line 327, i.e., I changed
 *     ```wp-block-code
       $content = $elements['pages'][ $page_no - 1 ];
       ```
   
 * to
 *     ```wp-block-code
       echo '<pre>'.print_r($elements, true).'</pre>';
       $content = $elements['pages'][ $page_no - 1 ];
       ```
   
 * and got the following output
 *     ```wp-block-code
       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](https://wordpress.org/support/users/htmgarcia/)
 * (@htmgarcia)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16947945)
 * Hi [@billb101](https://wordpress.org/support/users/billb101/),
   which WordPress,
   PHP and PublishPress Blocks versions are you using?
 * Regards
 *  Thread Starter [billb101](https://wordpress.org/support/users/billb101/)
 * (@billb101)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16948010)
 * **PHP Version:** 7.4.33
 * **WordPress Version:** 6.2.2 (WordPress Multisite, folder based)
 * **PublishPress Blocks Version:** 3.1.5
 *  Plugin Author [htmgarcia](https://wordpress.org/support/users/htmgarcia/)
 * (@htmgarcia)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16948155)
 * Thanks [@billb101](https://wordpress.org/support/users/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](https://wordpress.org/support/users/rizaardiyanto/)
 * (@rizaardiyanto)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16970345)
 * [@billb101](https://wordpress.org/support/users/billb101/) Have you had a chance
   to check our dev suggestion above?
 *  Thread Starter [billb101](https://wordpress.org/support/users/billb101/)
 * (@billb101)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16980662)
 * [@rizaardiyanto](https://wordpress.org/support/users/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](https://wordpress.org/support/users/rizaardiyanto/)
 * (@rizaardiyanto)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16988363)
 * [@billb101](https://wordpress.org/support/users/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.

 * ![](https://ps.w.org/advanced-gutenberg/assets/icon-256x256.png?rev=3393761)
 * [PublishPress Blocks - Block Controls, Block Visibility, Block Permissions](https://wordpress.org/plugins/advanced-gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-gutenberg/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [Riza Maulana Ardiyanto](https://wordpress.org/support/users/rizaardiyanto/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/parameter-must-be-an-array-and-access-array-offset-errors/#post-16988363)
 * Status: resolved