You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.
Fatal error: Uncaught TypeError: Argument 2 passed to Hyyan\WPI\Product\Variable::duplicateVariations() must be an instance of WP_Post, null given, called in /var/www/develop/public/wp-includes/class-wp-hook.php on line 298 and defined in /var/www/develop/public/wp-content/plugins/woo-poly-integration/src/Hyyan/WPI/Product/Variable.php:57 Stack trace: #0 /var/www/develop/public/wp-includes/class-wp-hook.php(298): Hyyan\WPI\Product\Variable->duplicateVariations(0, NULL, false) #1 /var/www/develop/public/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array) #2 /var/www/develop/public/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #3 /var/www/develop/public/wp-includes/post.php(3510): do_action('save_post', 0, NULL, false) #4 /var/www/develop/public/wp-admin/includes/post.php(607): wp_insert_post(Array) #5 /var/www/develop/public/wp-admin/post-new.php(83): get_default_post_to_edit('presse', true) #6 {main} thrown in /var/www/develop/public/wp-content/plugins/woo-poly-integration/src/Hyyan/WPI/Product/Variable.php on line 57
The text was updated successfully, but these errors were encountered:
your custom post should derive from WP_Post, many plugins including this one hook save_post and this hook is expecting to receive a WP_Post as defined in WordPress. If the post is not of the relevant type it will exit without taking any action.
How are you triggering save_post and Is there a problem with the post you are trying to save?
do_action('save_post', 0, NULL, false)
the standard wp_insert_post() saves the post and gets the ID from the insert before proceeding to call:
/**
* Fires once a post has been saved.
*
* @since 1.5.0
*
* @param int $post_ID Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated or not.
*/
do_action( 'save_post', $post_ID, $post, $update );
If there is an error on save the code bails and doesn't get this far, so in normal use this would never get called with zero and null... are you triggering this action in a different way?
At least I have plenty of custom post types and not seen this type of problem.
Can you reproduce this issue on default Wordpress theme (eg Storefront)?
No, custom type are not init
Can you reproduce this issue when all other plugins are disabled except WooCommerce, Polylang and Hyyan WooCommerce Polylang Integration?
Cant test
What product versions and settings are you using when this issue occurs?
Steps to Reproduce
My custom type fonction
What Happened Instead
Fatal error: Uncaught TypeError: Argument 2 passed to Hyyan\WPI\Product\Variable::duplicateVariations() must be an instance of WP_Post, null given, called in /var/www/develop/public/wp-includes/class-wp-hook.php on line 298 and defined in /var/www/develop/public/wp-content/plugins/woo-poly-integration/src/Hyyan/WPI/Product/Variable.php:57 Stack trace: #0 /var/www/develop/public/wp-includes/class-wp-hook.php(298): Hyyan\WPI\Product\Variable->duplicateVariations(0, NULL, false) #1 /var/www/develop/public/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array) #2 /var/www/develop/public/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #3 /var/www/develop/public/wp-includes/post.php(3510): do_action('save_post', 0, NULL, false) #4 /var/www/develop/public/wp-admin/includes/post.php(607): wp_insert_post(Array) #5 /var/www/develop/public/wp-admin/post-new.php(83): get_default_post_to_edit('presse', true) #6 {main} thrown in /var/www/develop/public/wp-content/plugins/woo-poly-integration/src/Hyyan/WPI/Product/Variable.php on line 57
The text was updated successfully, but these errors were encountered: