humanmade / network-media-library

Network Media Library plugin for WordPress Multisite
MIT License
290 stars 55 forks source link

Fix a bug on return format #59

Closed ixkaito closed 2 years ago

ixkaito commented 5 years ago

Network-media-library ignores the return format on the central media site.

johnbillion commented 5 years ago

Thanks for the report. NML shouldn't need to make any changes to the return value of this function when operating on the central media site.

What's the exact issue that's occurring? Can you share a code example please?

ixkaito commented 5 years ago

If I set "Image Object" as the Return Value for an image field, var_dump( get_field( 'image' ) ); wouldn't return an array but a string of ID (e.g. string '2058' (length=4)) on the central media site, but this returns an array (e.g. array (size=24) 'ID' => int 2058 ...) normally on sites other than the central media site.

joiglifberg commented 5 years ago

I can confirm this. The issue is that if a return format other than ID is used for a field fetched with get_field on the central media site, the following conditional won't be true and the return format won't be respected.

https://github.com/humanmade/network-media-library/blob/master/network-media-library.php#L445

ixkaito commented 2 years ago

This was not the correct approach, so I'll close it. See #91