Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#55022 closed defect (bug) (duplicate)

inconsistency with get_current_network_id()

Reported by: millerf01's profile millerf01 Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.0
Component: Networks and Sites Keywords:
Focuses: Cc:

Description

Hi there,

I am working on a project that has a multi-multisites installation.
I could not find any realted ticket so I decided to open one. Sorry if it duplicates...

And I found something that looks like an inconsistency to me:
If you have 2 network sites and switch from one to the other with switch_to_blog(), get_current_network_id() keeps returning the first network.

It boils down to global $current_site; not being updated with switch_to_blog().

It looks like intended as I cannot expect this to have been overlooked, but I really don['t understand why....

Thanks a lot for the good work!

Change History (3)

#1 @spacedmonkey
2 years ago

Hello @millerf01

I strongly recommend that use the wp-multi-network plugin when using the multiple networks.

It is worth noting, that I flagged this issue in the plugin as well. However, in that plugin there is also a switch_to_network to function.

I would start by installing that plugin and see if it fixes your issues.

#2 @millerf01
2 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #40513.

Thanks for those details @spacedmonkey .

I can also see that the issue was flagged on #40513... A mere 5 years ago.

I think I should be fine not using any other plugin for now. I was just wondering if it was a known issue.

Thanks a lot for your time.

Last edited 2 years ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
2 years ago

  • Milestone Awaiting Review deleted

Thanks for the follow-up and finding that ticket :)

It looks like there is an even older related ticket as well: #25293.

Note: See TracTickets for help on using tickets.