Hey @tomwhita,
The association field data is serialized like this:
a:3:{i:0;s:12:"post:page:48";i:1;s:12:"post:page:10";i:2;s:11:"post:page:8";}
which eventually unserializes to:
(
[0] => post:page:48
[1] => post:page:10
[2] => post:page:8
)
As listed in the field documentation, an association field can have more than one value, and each value can be a post type, taxonomy term, user or comment. In this example, there are 3 selected items, all of them are pages.
Basically, each value is formed like this:
{type}:{subtype}:{id}
where:
1. {type} is the data type - post, term, user or comment.
2. {subtype} is the data subtype - which is the post_type if using a post, or the taxonomy if using a term, user for users and comment for Idea.
3. {id} is the ID of the post, term, user or comment.
So, now to your case. You want to insert a valie with the ID of a project, it would consist of one selected item, a post with post type project. If the project has ID of 123, your entry would look like this:
post:project:123
and in order to insert it so it properly serializes, it has to be an array, like this:
array( 'post:project:123' )
Please, let us know if you have any other questions.
Regarding contribution: any kind of contribution is welcome in the GitHub repos of the project: https://github.com/htmlburger/carbon-fields and the docs: https://github.com/htmlburger/carbon-fields-docs .
In the project repo you could contribute by feature requests, bug fixes, code improvements, and even translations.
In the docs repo you can always suggest ideas for improvement and for including undocumented features. The latest release of the documentation (corresponding to the latest release of Carbon Fields) is always automatically pushed on http://carbonfields.net/
Have fun ;)
برچسب:
نویسنده: استخدام کار