Background of the issue:
I have a site in development and we were getting ready to populate the new language. To keep things clean, we deleted all the language content that was currently in the system to leave only the original language. Now, when I browse to the /wp-admin/edit.php?post_type=page&lang=pt-pt page, I get a fatal error. It is worth noting that the page does load once (from time to time), and then on refresh, the error appears. If a single page is left in the new language, then I am able to view the list page above; however, as soon as it is moved to trash, I get the error on the second load. I have also copied the system locally (using WP Migrate Pro) and am unable to re-create the issue.
Symptoms:
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /xxxxxxx/wp-content/plugins/sitepress-multilingual-cms/menu/post-menus/wpml-posts-listing-page.class.php:26
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /xxxxxxx/wp-content/plugins/sitepress-multilingual-cms/menu/post-menus/wpml-posts-listing-page.class.php:26#012Stack trace:#012#0 /xxxxxxx/wp-includes/class-wp-hook.php(324): WPML_Posts_Listing_Page->pre_populate_caches(Object(WP))#012#1 /xxxxxxx/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)#012#2 /xxxxxxx/wp-includes/plugin.php(565): WP_Hook->do_action(Array)#012#3 /xxxxxxx/wp-includes/class-wp.php(830): do_action_ref_array('wp', Array)#012#4 /xxxxxxx/wp-includes/functions.php(1336): WP->main(Array)#012#5 /xxxxxxx/wp-admin/includes/post.php(1306): wp(Array)#012#6 /xxxxxxx/wp-admin/includes/class-wp-posts-list-table.php(165): wp_edit_posts_query()#012#7 /xxxxxxx/wp-admin/edit.php(235): WP_Posts_List_Table->prepare_items()#012#8 {main}#012 thrown in /xxxxxxx/wp-content/plugins/sitepress-multilingual-cms/menu/post-menus/wpml-posts-listing-page.class.php on line 26
Questions:
Why does the fatal error occur when browsing to the specified page?
Why does the error not occur when a single page is left in the new language?
Why am I unable to recreate the issue locally?
Here is the ticket. I will need to closely examine your website. Therefore, I will require temporary access (WP-Admin and FTP) to a test site where the problem has been replicated, if possible. This will enable me to provide better assistance and determine if any configurations need to be modified.
Please note that it is important to have a backup for security purposes and to prevent any potential data loss. You can use the UpdraftPlus plugin (https://wordpress.org/plugins/updraftplus/) to fulfill your backup requirements.
Your upcoming reply will be treated with confidentiality and will only be visible to you and me.
✙ To resolve the issue, I may need your consent to deactivate and reactivate plugins and the theme, as well as make configuration changes on the site if necessary. This emphasizes the significance of having a backup.
The topic ‘[Closed] Fatal error Argument must be of type Countable|array’ is closed to new replies.