Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for switched site context in CMB_Meta_Box::save() #335

Open
dnaber-de opened this issue Jul 27, 2016 · 1 comment
Open

Check for switched site context in CMB_Meta_Box::save() #335

dnaber-de opened this issue Jul 27, 2016 · 1 comment
Labels
Milestone

Comments

@dnaber-de
Copy link

The method CMB_Meta_Box::save() assumes it runs in a site context it was initialized in. That means if any other component runs a switch_to_blog() and triggers the save_post action, your plugin writes data to a wrong object (in a wrong site). This already leads to concrete issues.

However, this is easy to solve by just adding the following guard to your save_post handler:

if ( is_multisite() && ms_is_switched() )
    return;

If appreciated I would provide a pull request.

@mikeselander
Copy link
Contributor

This sounds reasonable to me, any thoughts @mattheu?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants