Open chrisaldrich opened 7 years ago
At this point, I can't change it directly as it will break backwards-compatibility, but i've added a filter to allow modifying the meta key/values pre-save. To do so with the geodata:
function dw_modify_dsgnwrks_instagram_post_meta_pre_save( $meta, $pic ) {
$meta['geo_latitude'] = $meta['instagram_location_lat'];
unset( $meta['instagram_location_lat'] );
$meta['geo_longitude'] = $meta['instagram_location_long'];
unset( $meta['instagram_location_long'] );
if ( isset( $pic->location->public ) ) {
$meta['geo_public'] = ! empty( $pic->location->public ) ? 1 : 0;
}
if ( ! empty( $meta['instagram_location_name'] ) ) {
$meta['geo_address'] = $meta['instagram_location_name'];
}
unset( $meta['instagram_location_name'] );
return $meta;
}
add_filter( 'dsgnwrks_instagram_post_meta_pre_save', 'dw_modify_dsgnwrks_instagram_post_meta_pre_save', 10, 2 );
I tested this out last week and didn't have a chance to say: Thanks @jtsternberg! This works perfectly!
Any reason we couldn't do both?
That would store redundant data in the DB, and generally I'm not a fan of that, but maybe for this, we should make an exception, as those meta-keys are the accepted expectation.
Yea, I agree with you in principal, that storing redundant info is unnecessary.
In this case, though, I think storing redundant info for now, and maybe changing the documentation to say something like "The instagram_location_*
fields are deprecated and will be removed in v3.x" might be the best plan.
Let's do it.
It would be nice if the plugin stored the GPS coordinates with the standard/suggested WordPress standard: https://codex.wordpress.org/Geodata
This would allow the usage of secondary plugins (like Simple Location) to access the stored data and do something with it.