內容簡介
如果在儲存文章時,在「發佈文章」框中選取了適當的勾選方塊,該外掛會讀取文章的特色圖片 EXIF 數據,並添加文章標籤和一個自定義的元數值「位置 (location)」,其中包含圖片序列化的 GPS 位置數據。
如果文章沒有特色圖片,或者特色圖片的 EXIF 數據不完整,則不會發生任何事情。
該外掛直接從圖像文件中讀取 EXIF 數據,而不是從數據庫項目中讀取。
如果特色圖片的 EXIF 數據中沒有可用的「GPS 經度 (GPSLongitude)」和「GPS 緯度 (GPSLatitude)」標準值,該文章將不會被更新為自定義元數據領域。(如果發生這種情況,預先存在的值不會被刪除。)
在保存文章標籤時,會設置標準分類法「post_tag」。如果需要修改此項目,例如在自定義分類法的情況下,則可以使用過濾器掛鉤「update-post-with-exif-data/post_taxonomy」進行更改。
如果要在 WordPress 後台查看包含序列化 GPS 位置數據的自定義元數值,則需要解析數據並自己添加該領域。對於此問題,Elliot Condon 的「進階自訂欄位」(Advanced Custom Fields) 插件,使用「Google 地圖」欄位類型,是一個不錯的解決方案。
開發者:請參閱 WordPress 行動掛鉤代碼「update-post-with-exif-data/no-gps」,當特色圖片中沒有有效的 GPS 數據時,此代碼可能會觸發。
外掛標籤
開發者團隊
原文外掛簡介
If the appropriate checkboxes are selected in the Post submit box when saving the Post, the plugin reads the EXIF data of the Post’s Featured Image and adds Post Tags and a custom meta value “location” containing the serialized GPS location data of the image.
If the Post has no Featured Image, or if the Featured Image’s EXIF data is incomplete, then nothing happens.
The EXIF data is read directly from the image file, not from a database entry.
If standard values “GPSLongitude” and “GPSLatitude” are not available in the Featured Image’s EXIF data, the post will not be updated with the custom meta field. (A pre-existing value will not be deleted, if this happens.)
When saving Post Tags, the standard taxonomy post_tag is set. If you need to modify this, for example in the case of a custom taxonomy, then you can use the filter hook update-post-with-exif-data/post_taxonomy to change it.
If you want to see the custom meta value containing serialized GPS location data in the WordPress backend, you’ll need to parse the data and add this field yourself. A good solution for this is the “Advanced Custom Fields” plugin by Elliot Condon, with field type “Google Map”.
Developers: see the code for a WordPress action hook update-post-with-exif-data/no-gps, which fires in the event that there is no valid GPS data available in the Featured Image.
