wp-posts-to-posts
wp-posts-to-posts copied to clipboard
Payment_complete not working with p2p
Hi,
I want to get all connected posts during a woocommerce_payment_complete but I keep getting this message: 'Call to a member function get_connected() on boolean' or 'Can't determine direction for 'multiple_authors' type'. It seems like the payment_complete fires before the p2p_init hook.
Does anyone have any solutions for this?
$connected = $wpdb->get_var( $wpdb->prepare( " SELECT p2p_from FROM $wpdb->p2p WHERE p2p_type=%s AND p2p_to=%d ", 'your_connection_type', $post_id ) );