The function simple_fields_set_value() is used to update a simple field for a post.
5 thoughts on “Setting Field Values”
Leave a Reply Cancel reply
Documentation & Examples
Recent Posts
-
“Simple Fields Minimizer” makes it possible to collapse repeater fields
9 Aug 2017
-
The end of the road is here
27 Feb 2016
-
Quick tip: set post connector using PHP code
26 Aug 2013
-
Simple Fields and WordPress 3.6
2 Aug 2013
-
Define Post Connector in Page Template
1 Aug 2013
If I execute commands
simple_fields_set_value($postId, ‘roomid’, null, ‘booking’, $formData[‘roomid’]);
simple_fields_set_value($postId, ’email’, null, ‘booking’, $formData[’email’]);
then second field not updated.
But if I execute
simple_fields_set_value($postId, ‘roomid’, 0, ‘booking’, $formData[‘roomid’]);
simple_fields_set_value($postId, ’email’, 0, ‘booking’, $formData[’email’]);
all is right.
It was because $num_in_set in simple_fields/functions.php is global counter and accumulated with next command. To reset it – pass $num_in_set parameter not null.
So… I’ve just written few handy functions to deal with saving, updating and deleting Simple Field items. I have to ask my employer if I can publish it. Also it needs tests.
hey Par,
push push 😉
I too would like to know about it
Hey Par,
Is there a way to delete Simple Field items this way?