Hi we have custom post type that'ss created when a form is submitted- it comes into the site as pending. When we try to edit the post or even to just publish it with out editing it we Get this error
All plugins and wordpress core are up to date
Can you provide some guidance?
An error of type E_ERROR was caused in line 1048 of the file /home4/hiddeob4/public_html/wp-content/plugins/wp-views/vendor/toolset/toolset-common/lib/adodb-time.inc.php. Error message: Uncaught TypeError: abs(): Argument #1 ($num) must be of type int|float, string given in /home4/hiddeob4/public_html/wp-content/plugins/wp-views/vendor/toolset/toolset-common/lib/adodb-time.inc.php:1048
Stack trace:
#0 /home4/hiddeob4/public_html/wp-content/plugins/wp-views/vendor/toolset/toolset-common/lib/adodb-time.inc.php(1048): abs('2021-07-31')
#1 /home4/hiddeob4/public_html/wp-content/plugins/types/vendor/toolset/types/embedded/includes/fields/date.php(320): adodb_date('H', '2021-07-31')
#2 /home4/hiddeob4/public_html/wp-includes/class-wp-hook.php(307): wpcf_fields_date_value_get_filter('2021-07-31', Object(WP_Post))
#3 /home4/hiddeob4/public_html/wp-includes/plugin.php(189): WP_Hook->apply_filters('2021-07-31', Array)
#4 /home4/hiddeob4/public_html/wp-content/plugins/wp-views/vendor/toolset/toolset-common/toolset-forms/classes/class.field_factory.php(92): apply_filters('wpcf_fields_typ...', '2021-07-31', Object(WP_Post))
#5 /home4/hiddeob4/public_html/wp-content/plugins/wp-views/vendor/toolset/toolset-common/toolset-forms/classes/class.date.php(59): FieldFactory->getValue()
#6 /home4/hiddeob4/public_html/wp-content/plugins/wp-views/vendor/toolset/toolset-common/toolset-forms/classes/class.form_factory.php(309): WPToolset_Field_Date->metaform()
#7 /home4/hiddeob4/public_html/wp-content/plugins/wp-views/vendor/toolset/toolset-common/toolset-forms/bootstrap.php(66): FormFactory->metaform(Array, 'wpcf[adoption-d...', Array)
#8 /home4/hiddeob4/public_html/wp-content/plugins/wp-views/vendor/toolset/toolset-common/toolset-forms/api.php(25): WPToolset_Forms_Bootstrap->field('post', Array, Array)
#9 /home4/hiddeob4/public_html/wp-content/plugins/types/vendor/toolset/types/embedded/includes/fields-post.php(254): wptoolset_form_field('post', Array, Array)
#10 /home4/hiddeob4/public_html/wp-content/plugins/types/vendor/toolset/types/embedded/admin.php(105): wpcf_add_meta_boxes('adoption-story', Object(WP_Post))
#11 /home4/hiddeob4/public_html/wp-includes/class-wp-hook.php(307): wpcf_admin_add_meta_boxes('adoption-story', Object(WP_Post))
#12 /home4/hiddeob4/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#13 /home4/hiddeob4/public_html/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
#14 /home4/hiddeob4/public_html/wp-admin/includes/meta-boxes.php(1581): do_action('add_meta_boxes', 'adoption-story', Object(WP_Post))
#15 /home4/hiddeob4/public_html/wp-admin/edit-form-advanced.php(271): register_and_do_post_meta_boxes(Object(WP_Post))
#16 /home4/hiddeob4/public_html/wp-admin/post.php(206): require('/home4/hiddeob4...')
#17 {main}
thrown
Hi,
Thank you for contacting us and I'd be happy to assist.
To troubleshoot this, I'll suggest the following steps:
1. It would be interesting to test this with all non-Toolset plugins disabled and a default theme like Twenty Twenty-One.
If it's fixed, you can start adding the disabled items, one by one, to narrow down to a possible conflicting one.
3. In case the issue still persists, I'll need to see how this custom post type and its relevant fields are set up in the admin area, for further investigation. You're welcome to share temporary admin login details, along with the name of that custom post type.
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing the admin access.
I can see the issue on your website, but couldn't reproduce this on my test website. This suggests that something specific to your website is involved.
Do I have your permission to download a clone/snapshot of your website? This will help in troubleshooting this on a different server.
Yes of course. Thanks so much
Thank you for the permission and I've downloaded the duplicator package.
I'll be performing some tests and will share the findings as soon as this testing completes.
Thank you for your patience.
Just wanted to let you know that I'm still working on this and will share the findings with you, today.
Thanks for keeping me in the loop
Thank you for waiting.
During troubleshooting, I noticed that the "Adoption Stories" posts that are showing the error are the ones where the date format for the Toolset Types field "Adoption Date" is not correct.
Toolset Types stores and expects the date type field to be in the UNIX timestamp format. But, for the problematic posts, that date is stored in the YYYY-MM-DD format ( e.g. 1987-10-11 ). I suspect some third-party form or an import plugin was used to store these values in this field, which is causing this error.
Please make sure that when saving the date value in this Toolset date type field, it is always stored in the UNIX timestamp format.
For the posts, which are already affected, you can access the database through a tool like phpMyAdmin and look for all the values stored in the "wp_postmeta" table, where the "meta_key" is equal to "wpcf-adoption-date":
SELECT * FROM `wp_postmeta` WHERE meta_key="wpcf-adoption-date";
For the entries where the date format is not correct, you can either replace it with the correct UNIX timestamp format value or delete it, so that the post can be edited from the admin area.
I hope this helps and please let me know if you need any further assistance around this.
Yes thanks- thats exactly it the data is submitted through a form. I'll change the field to text and we'll be all set.
Really appreciate the help