[Resolved] Crash when a custom post type has no posts
This thread is resolved. Here is a description of the problem and solution.
Problem: If you're experiencing a fatal error when accessing the Pronamic plugin in the admin site, particularly when a custom post type has no posts, this might be due to a specific configuration issue.
Solution: We have identified that the issue is not directly caused by WPML. However, setting
'hierarchical' => false
in the Pronamic Pay with Rabo Smart Pay for WooCommerce plugin's custom post type (CPT) registration can prevent this issue. This adjustment addresses the root of the problem by modifying how the CPT is handled.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Additionally, if you need further assistance, please open a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
I am trying to: In admin site crashes when I go to a plugin "pronamic". Link to a page where the issue can be seen: hidden link
Symptoms:
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-content/plugins/sitepress-multilingual-cms/menu/post-menus/wpml-posts-listing-page.class.php:26 Stack trace: #0 /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-includes/class-wp-hook.php(324): WPML_Posts_Listing_Page->pre_populate_caches() #1 /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #2 /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-includes/plugin.php(565): WP_Hook->do_action() #3 /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-includes/class-wp.php(830): do_action_ref_array() #4 /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-includes/functions.php(1336): WP->main() #5 /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-admin/includes/post.php(1306): wp() #6 /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-admin/includes/class-wp-posts-list-table.php(165): wp_edit_posts_query() #7 /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-admin/edit.php(235): WP_Posts_List_Table->prepare_items() #8 {main} thrown in /home/1311505.cloudwaysapps.com/vjpjkymsjk/public_html/wp-content/plugins/sitepress-multilingual-cms/menu/post-menus/wpml-posts-listing-page.class.php on line 26. There has been a critical error on this website. Please check your site admin email inbox for instructions.
Questions:
How can I resolve the fatal error when accessing the Pronamic plugin in the admin site?
What steps should I take to prevent the site from crashing when a custom post type has no posts?
As mentioned by my colleague during the chat that this issue hasn't been raised with WPML since it is not due to WPML but from the incompatible plugins "Pronamic" and "Object Cache Pro".
Because we can not reproduce this issue with only WPML, as well as, with "Pronamic". So the provided workaround is a temporary one. While I recommend checking with the said plugin authors.
On the other hand, can you install Object Cache Pro at hidden link and reproduce the error?
I'll also request to try creating a custom post via another plugin and see if you can reproduce the same issue?
Please let me know and I'll try my best to help you further on the matter.
Thank you for your patience and cooperation. I was also not able to configure Object Cache Pro and Redis Object Cache plugins due to licenses.
However, I tried WC Total Cache which offers Object Caching also and then created a new gateway post in hidden link.
I tried this a few times by emptying these posts and every time it worked fine.
Can you please take a look at the said plugin's caching features (hidden link) and see if you can configure it like yours? And if the issue can be reproduced.
This way we can see if issue with Object Caching's particular config or specifically with Object Cache Pro and I'll be able to escalate the issue accordingly.
Oh ok, thank you for clarifying, I should've checked.
I am working on it and 'll get back to you accordingly.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.