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

meta-box not saving data #248

Closed
venca163 opened this issue Mar 15, 2013 · 9 comments
Closed

meta-box not saving data #248

venca163 opened this issue Mar 15, 2013 · 9 comments

Comments

@venca163
Copy link
Contributor

Hello,

couple days ago I have forked and cloned Meta-box and saved it to brand new Wordpress installation to /plugin (newest version both, Meta-box & Wordpress - no other plugins installed). But when I tried to run "demo.php" (as described here) and in WP admin clicked on "new post" wordpress gave me "Are you sure you want to do this? try again later" with no option to proceed. After I remove 2nd meta box from demo.php and clicked on "new post" again, wordpress showed me Meta-box inputs, but after I typed another values and saved it no change of default values was stored into database (I double checked it).

I tried to download Meta-box straight from WP administration and that way everything worked perfectly.

Am I doing something wrong or is this some kind of bug?

Thank you for any help

@funkatron82
Copy link
Contributor

Try turning off autosave. Go to the demo code and set autosave to false
On Mar 15, 2013 9:47 AM, "Václav Hoštička" notifications@github.com wrote:

Hello,

couple days ago I have forked and cloned Meta-box and saved it to brand
new Wordpress installation to /plugin (newest version both, Meta-box &
Wordpress - no other plugins installed). But when I tried to run "demo.php"
(as described herehttp://www.deluxeblogtips.com/meta-box/getting-started/)
and in WP admin clicked on "new post" wordpress gave me "Are you sure you
want to do this? try again later" with no option to proceed. After I remove
2nd meta box from demo.php and clicked on "new post" again, wordpress
showed me Meta-box inputs, but after I typed another values and saved it no
change of default values was stored into database (I double checked it).

I tried to download Meta-box straight from WP administration and that way
everything worked perfectly.

Am I doing something wrong or is this some kind of bug?

Thank you for any help


Reply to this email directly or view it on GitHubhttps://github.com//issues/248
.

@venca163
Copy link
Contributor Author

Thanks for reply. Unfortunately if I turn autosave off, I am not even possible to load "new post" page (wordpress gives me still the same message: "Are you sure you want to do this? try again later").

@tyl3r
Copy link

tyl3r commented Mar 15, 2013

I have the same problem, since i upgraded the plugin to latest zip i can't add post/page/custom post type:

bug

I also checked with demo.php metaboxes and the error is the same.

@funkatron82
Copy link
Contributor

Sounds like whatever change rilwis made for the autosave feature is messing up when you create a new post/page. Definitely related to the nonce detection.

@ghost
Copy link

ghost commented Mar 15, 2013

Not a solution, but this is the notice you'll get when WP_DEBUG is enabled: #246

@funkatron82
Copy link
Contributor

Yup, definitely related. When rilwis changed the code to allow autosaving, it messed something up when you create a post.

@funkatron82
Copy link
Contributor

This is what I think the problem is: The save_post function checks for the nonce for the fields and is the nonce is none existent or wrong, it fails, giving us the "are you sure" message. The problem is that a new post doesn't have the nonce, so it invariably fails when you try to create a new post

@funkatron82
Copy link
Contributor

Okay, think I found a solution: Basically, the problem is the checker in save_post. All we really need to check is whether a. the nonce field exists and b. the nonce is valid. We don't need to check for AutoSave anymore since we are using autosave in our code and this should also skirt the issue with quick saves because the nonce won't be there.

I'm gonna do some testing to make sure that this is ironclad and works always before I post a solution to the issue

@rilwis rilwis closed this as completed in 6221daa Mar 23, 2013
@funkatron82
Copy link
Contributor

Nice solution. Didn't know Wordpress already checks for capabilities but it makes sense

This issue was closed.
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

No branches or pull requests

3 participants