marliesprins
Forum Replies Created
-
Forum: Hacks
In reply to: wordpress saving blanks custom posts when removing title, excerpt or editorThat’s exactely what I was looking for, thanks!!
Forum: Hacks
In reply to: wordpress saving blanks custom posts when removing title, excerpt or editorIn addition to the above, I just noticed that the blank line is only visible if one leaves the edit/add new screen when the error messages about using wrong formats appear. If the user fixes the input fields where the error is made, as prompted, the empty line is adjusted and turned into a regular line containing the information about the post.
I downloaded some plugins from the plugin store and noticed that they all have the same ‘issue’ when a post is saved if there’s no data entered. So I guess it doesn’t matter as much as I thought. Though I do still wonder why it happens at all.
Forum: Hacks
In reply to: $_POST data cannot be retrieved/is empty?Thanks for answering!
I looked into what you said and I think I am going for a transient. (never heard of it before but it seems the sensible choice, from what I am reading about it) I was hoping to avoid using the database but there doesn’t seem to be any other option. Using a session variable would be great but I read it can potentially cause a lot of trouble in wordpress so I rather not.
I am a bit surprised there isn’t an easier way to verify input in custom meta fields though. But at least I can finish the custom post type now. Thanks 🙂
By the way, return ends the execution of all code in a function, so everything that comes after a return is never executed. That’s why it’s not saved. (the code that actually saves the metadata comes after all the verification checks) I used $postid as a parameter because all other safety measures commonly used in custom post types(autosave, error with nonsefields, wrong capabilities) seem to use it.
BUt since you mention a redirect, I guess the postid is passed here to get back to the right post.