Title: Wrong redirect
Last modified: June 1, 2026

---

# Wrong redirect

 *  Resolved [thomas83at](https://wordpress.org/support/users/thomas83at/)
 * (@thomas83at)
 * [1 week ago](https://wordpress.org/support/topic/wrong-redirect-9/)
 * Hello B2BKing Support,
 * we found a compatibility issue between B2BKing and WooCommerce (latest version)
   when manually creating a new order in the WooCommerce admin.
 * When opening this WooCommerce admin URL:
   /wp-admin/admin.php?page=wc-orders&action
   =newthe request is incorrectly redirected to:/wp-admin/edit.php?post_type=b2bking_group
 * We debugged the redirect using a wp_redirect backtrace. The redirect is triggered
   here:
 * /wp-content/plugins/b2bking-wholesale-for-woocommerce/admin/class-b2bking-admin.
   php:1638
   B2bkingcore_Admin->b2bking_save_groups_metaboxes()
 * The backtrace shows that WooCommerce creates/saves the new order via HPOS, then
   WooCommerce creates a backup post via wp_insert_post(), and during that process
   the B2BKing group metabox save handler is executed.
 * Relevant call chain:
   WooCommerce PageController->setup_action_new_order()WC_Order-
   >save()OrdersTableDataStore->maybe_create_backup_post()wp_insert_post()do_action()
   B2bkingcore_Admin->b2bking_save_groups_metaboxes()wp_redirect()
 * So it looks like the B2BKing group metabox save handler is running during WooCommerce
   order creation, although it should only run for the B2BKing group post type.
 * As a temporary workaround, we solved the issue by blocking only this specific
   wrong redirect with the following snippet:
 *     ```wp-block-code
       add_filter('wp_redirect', function ($location, $status) {$request_uri = $_SERVER['REQUEST_URI'] ?? '';$is_new_wc_order_screen =    is_admin()    && strpos($request_uri, 'admin.php?page=wc-orders') !== false    && strpos($request_uri, 'action=new') !== false;$is_wrong_b2bking_redirect =    strpos($location, 'edit.php?post_type=b2bking_group') !== false;if ($is_new_wc_order_screen && $is_wrong_b2bking_redirect) {    return false;}return $location;}, 999999, 2);
       ```
   
 * This workaround prevents the wrong redirect and allows the WooCommerce “new order”
   screen to load correctly.
 * However, this is only a temporary workaround. The proper fix should be inside
   B2BKing: the function b2bking_save_groups_metaboxes() should return early unless
   the current saved post is actually a b2bking_group post type.
 * For example, something like:
 * `if (get_post_type($post_id) !== 'b2bking_group') {
   return;}
 * Please check why B2BKing performs a redirect to edit.php?post_type=b2bking_group
   during WooCommerce HPOS order creation and restrict this handler/redirect to 
   the B2BKing group post type only.
   – All other plugins was disabled.– Default 
   htacces– No caching enabled– Default wp theme– tested in private tab.
 * Thank you.
   BRTommy
    -  This topic was modified 1 week ago by [thomas83at](https://wordpress.org/support/users/thomas83at/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [Stefan](https://wordpress.org/support/users/stefanst1/)
 * (@stefanst1)
 * [6 days, 18 hours ago](https://wordpress.org/support/topic/wrong-redirect-9/#post-18925589)
 * Hi Tommy,
 * Thank you for using our plugin,
 * This issue is related to one of the restrictions in our Core vs. Pro plugin. 
   The Core (free) plugin enforces a limit of maximum 2 B2B groups and it does not
   allow creating more, by redirecting during group creation.
 * This should not be interfering with orders, so that part of it is indeed a bug–
   we are looking at addressing this issue shortly and thank you for reporting it.
 * However, the problem suggests you have more than 2 groups on Core, which should
   not be possible.
 * **Please check: if you are also using B2BKing Pro, it’s possible you may have
   accidentally deactivated it.**
 * We will look at releasing an update shortly addressing the orders conflict, I
   will update you once that’s released,
 * Stefan
 *  Thread Starter [thomas83at](https://wordpress.org/support/users/thomas83at/)
 * (@thomas83at)
 * [6 days, 17 hours ago](https://wordpress.org/support/topic/wrong-redirect-9/#post-18925613)
 * Hello,
   we only using B2B King free edition.Any cacne to get a quick fix? Its 
   an absolute no go that your plugin cause a issue in one of the most important
   options of woocommerce: admin can not create an order when B2B King free edition
   is enabled.BRTommy
 *  Plugin Support [Stefan](https://wordpress.org/support/users/stefanst1/)
 * (@stefanst1)
 * [6 days, 16 hours ago](https://wordpress.org/support/topic/wrong-redirect-9/#post-18925657)
 * Hi again,
 * We’ve released an update now, version 5.2.30, with a fix.
 * Let me know if you have any further issues after updating,

Viewing 3 replies - 1 through 3 (of 3 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwrong-redirect-9%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/b2bking-wholesale-for-woocommerce/assets/icon-256x256.gif?
   rev=3025903)
 * [B2BKing — Ultimate WooCommerce B2B and Wholesale Plugin — Wholesale Prices, Bulk Order Form & More](https://wordpress.org/plugins/b2bking-wholesale-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/b2bking-wholesale-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/b2bking-wholesale-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/b2bking-wholesale-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/b2bking-wholesale-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/b2bking-wholesale-for-woocommerce/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Stefan](https://wordpress.org/support/users/stefanst1/)
 * Last activity: [6 days, 16 hours ago](https://wordpress.org/support/topic/wrong-redirect-9/#post-18925657)
 * Status: resolved