@Scott, I tried out Pods just now and defined the same post types and custom fields that I previously defined with CCTM. I notice that Pods hooks a filter into
get_most_meta() by default namely
This was unexpected, and undesired, because a call to
get_post_meta() on a custom relationship field that was previously defined with CCTM, which holds a string like
["263","264","268"] as the
meta_value, now returns an array of WP_Post objects, rather than just the actual string value.
Also, when saving the post which holds this custom field, the meta_value which was previously one row in the DB holding the above string as meta_value, was suddenly split into 3 rows, each holding one ID as meta_value. This must be the result of another action hook from Pods. What class method is actually doing this DB change?
I'm puzzled about this behavior too, since Pods is using a different table wp_podsrel for relationships, and I can see the 3 rows defined there, so why alter the native wp_postmeta table and change the output structure of wp_get_meta()?
That would prompt me to change my plugin code. I didn't want to use the CCTM API to parse the content of relationship fields as I'm trying to have my code as independent as possible from other plugins. I guess I can just remove the filter before calling get_post_meta() but now I also have to revert the
wp_postmeta DB entries back to the old version.
Are other hooks added by default by Pods regarding fetching or updating/inserting custom field values or custom post type content? Would save me some time digging into the Pods docs or code, as my Plugin is almost entirely based on the native WP API for those operations, and I'm assuming that there are no additional action or filter hooks.
It may be down to preference but I think it's best not to hook filters into these native functions by default given that you're already providing a pretty full blown separate API. That way, people who want to use and depend on your API can still do so, but those who don't would at least not end up with broken code when activating or deactivating your plugin.
p.s. Also, there is a bug in Pods too (I'll report it properly): for a relationship field that uses a dropdown list to choose, the title shown in the dropdown is not applying the
the_title filters; it shows the raw title which in my case contains 3 versions for 3 different languages (qTranslate plugin). It however does apply the
the_title filters if it's a multiple select using checkboxes.