Skip to content

Instantly share code, notes, and snippets.

@bonny
Last active October 11, 2015 11:27
Show Gist options
  • Save bonny/3851542 to your computer and use it in GitHub Desktop.
Save bonny/3851542 to your computer and use it in GitHub Desktop.
Simple Fields function simple_fields_set_value()
<?php
/**
* Update/Set a value for a field for a post
* Warning: Highly untested!
*
* @param int $post_id
* @param string $field_slug field key
* @param int $numInSet if field is repeatable this tells what position it should be stored at. Default is null = add new
* @param mixed $post_connector string __none__, __inherit__, or int id of post connector to use for this post, if no connector is defined already
* @param probably array @new_value A bit sneaky, since every field can store it's field in it's own way. An array with key -> value is not that uncommon and is a pretty good guess.
* the map plugins stores it like this anyway:
* Array
* (
* [lat] => 59.94765909298758
* [lng] => 17.537915482803328
* )
*/
function simple_fields_set_value($post_id, $field_slug, $new_numInSet = null, $new_post_connector = null, $new_value) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment