Sanitisation file field
-
Hi,
I need to save attachment data for using them network wide in a multisite. I tried implementing this via
sanitization_cbcallback function. But when using a callback function for file type fields it’s impossible to change the file in the dashboard. Even if the callback function do nothing.Link with the code example:
http://joxi.ru/823gNV9h6gQYw2Able to change another image, but cannot save, eg:
http://joxi.ru/82QWRvZI1KkDorIs it possible to do this via callback function, or I have to use filter instead?
Thanks.
-
I’m not sure multisite has its own media library so where you end up saving the images is a bit up in the air. Probably not directly answering the question, but it’s something to make note of for sure.
Out of curiosity, is it saving as expected in single site?
The problem is actually not multisiting related. Just used the situation as an example.
So, yeah, the problem exists in a single site too. I think it’s related to the attachment id, which is not used in the callback, though used in CMB2 object.
P. S. Using “cmb2_override_{$a[‘field_id’]}_meta_value” filter for my needs 🙂
If I recall right, Justin passes in the attachment IDs as an array index.
The images aren’t coming up for me at the moment, but if any of the passed in values are arrays, I’d check the indexes on them and see if those match
The topic ‘Sanitisation file field’ is closed to new replies.