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

Pass $post_id in all WPSEO_Meta::get_value calls in metabox - fixes #1519 #1520

Merged
merged 2 commits into from
Sep 9, 2014

Conversation

mgmartel
Copy link
Contributor

If another plugin overwrites the global $post in post.php, the SEO metabox displays the metadata from the wrong post, and consequently saves the wrong data to the right post, leading to the strange behaviour of #1519.

WP SEO already fetched the correct post by checking for $_GET['post'] first, but didn't pass this post on in WPSEO_Meta::get_value calls. All get_value calls in the metabox now get the post ID as well. The check for $_GET['post'] was happening quite often in the class, so I also abstracted that into the private method WPSEO_Metabox::get_metabox_post().

Mike Martel added 2 commits August 31, 2014 10:00
The post is fetched by checking for $_GET['post_id'] or using the global $post as a fallback. This was repeated multiple times in the class, so a single method makes sense.
@jrfnl
Copy link
Contributor

jrfnl commented Aug 31, 2014

Nice! Even though I'm quite against building work-around for bugs introduced by other plugins which are doing things wrong, I think in this case the solution is elegant and simple enough. You have my vote.

omarreiss added a commit that referenced this pull request Sep 9, 2014
Pass $post_id in all WPSEO_Meta::get_value calls in metabox - fixes #1519, props @mgmartel
@omarreiss omarreiss merged commit 03c8cbf into Yoast:master Sep 9, 2014
@mgmartel mgmartel deleted the metabox-post-id branch May 10, 2015 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants