Hi there,
Do you have the fatal error log? If so, could you please share the full error log in your reply so we can check?
Fatal error: Uncaught Error: MailPoet\Automation\Integrations\WordPress\Fields\PostFieldsFactory::MailPoet\Automation\Integrations\WordPress\Fields\{closure}(): Return value must be of type bool, string returned
in /home/odilegenzo/www/wp-content/plugins/mailpoet/lib/Automation/Integrations/WordPress/Fields/PostFieldsFactory.php on line 241
Call stack:
MailPoet\A\I\W\F\PostFieldsFactory::MailPoet\A\I\W\F\{closure}()
array_filter()
wp-content/plugins/mailpoet/lib/Automation/Integrations/WordPress/Fields/PostFieldsFactory.php:242
MailPoet\A\I\W\F\PostFieldsFactory::getPostTypes()
wp-content/plugins/mailpoet/lib/Automation/Integrations/WordPress/Fields/PostFieldsFactory.php:46
MailPoet\A\I\W\F\PostFieldsFactory::getFields()
wp-content/plugins/mailpoet/lib/Automation/Integrations/WordPress/Subjects/PostSubject.php:58
MailPoet\A\I\W\S\PostSubject::getFields()
wp-content/plugins/mailpoet/lib/AdminPages/Pages/Automation.php:123
MailPoet\A\P\Automation::buildRegistry()
wp-content/plugins/mailpoet/lib/AdminPages/Pages/Automation.php:96
MailPoet\A\P\Automation::render()
wp-content/plugins/mailpoet/lib/Config/Menu.php:607
MailPoet\Config\Menu::automation()
wp-includes/class-wp-hook.php:324
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:348
WP_Hook::do_action()
wp-includes/plugin.php:517
do_action()
wp-admin/admin.php:259
Query Monitor
-
This reply was modified 5 months, 3 weeks ago by
odilegence.
Hi there,
Thanks for sharing the log with us! I see that this error is identical to the one reported previously in the forum. Could you try the steps we suggested here to troubleshoot this error: https://wordpress.org/support/topic/fatal-error-in-mailpoet-4-48-2-for-automation-welcome-mail/#post-17690265
Please let us know how this goes!
Hi,
Thanks for your feedback,
I tried everything that was indicated in the link you shared with me, but the problem is still there.
I still need to add in the file:
/www/wp-content/plugins/mailpoet/lib/Automation/Integrations/WordPress/Fields/PostFieldsFactory.php
This code –> (bool) on lige 241:
array_filter(
$postTypes,
function(\WP_Post_Type $type): bool {
return (bool) $type->public;
}
)
));
}
}
Waiting for your return to finally find a solution,
Waiting for your response,
Sincerely,
Odile
Hi there @odilegence,
I understand the issue here. First let me say that it is expected that this issue recurs with every update of the plugin, as by updating the plugin, you are overwriting the custom fix that you (or your developer) has added to this file. So, after upgrading, you would need to find the same file (i.e. plugins/mailpoet//lib/Automation/Integrations/WordPress/Fields/PostFieldsFactory.php) and insert the same coding fix each time.
That section of code is pulling out a list of all custom post types on the site. A properly registered custom post type should have a “public” flag that is a boolean. This issue appears to be happening because your site as some kind of custom post type that does not have this flag properly set.
If you know of any custom post types on your site, can you share that list with us? These could be created via another plugin, your theme, or custom code.
If you don’t know what custom post types your site might have, we would ask that you run a conflict test. As this can be disruptive to a live site, we’d recommend creating a staging site for testing if possible.
The idea would be to disable all plugins except MailPoet and revert your theme to a basic theme like Twenty Twenty, then verify that your automation is working and does not throw the error. Then, restore your theme and test again, then restore other plugins one at a time, testing each time.
When you hit the error, this will tell you which theme/plugin is creating the poorly configured custom post type. We would recommend reaching out to the developer of that theme or plugin to let them know they are not creating their custom post type correctly, and that it needs to be repaired.
If you do find the conflict source, please do let us know as we can also follow up with that developer.