
內容簡介
當上傳文件時,WordPress會從文件提取圖片元數據並添加到新創建的Attachment Post中的數據庫中。此外掛提取和保存比WordPress Core通常存儲的更廣泛的EXIF和IPTC信息。
此外掛目前僅支持JPEG和WEBP文件。
此外掛不會輸出任何數據在網站上或在WordPress管理區域中。如果需要此項功能,開發者需要修改生成網站HTML的主題或插件。
此外掛不會將信息添加到已創建的Attachment Post中。(但是,當新圖片上傳到現有的Attachment Post時(例如使用Enable Media Replace Plugin),此外掛會更新存儲的元數據。)
這些信息在Media編輯器中不可見,但開發人員在使用wp_get_attachment_metadata函數時可以使用。數據存儲在此函數返回的數組的子集中,該子集位於數組鍵shp_additional_metadata中。
例如:
<?php
$attachment_metadata = wp_get_attachment_metadata($attachment_id);
var_dump($attachment_metadata['shp_additional_metadata']);
鉤子Hooks
使用以下鉤子Hooks,可以在從文件檢索數據後對數據數組進行操作
所有其他數據
此外掛添加的所有IPTC數據。
<?php
apply_filters('shp_additional_metadata/iptc', $exif['iptc'], $source_path);
IPTC數據
此外掛添加的所有數據。
<?php
apply_filters('shp_additional_metadata/all_exif', $exif, $source_path);
外掛標籤
開發者團隊
② 後台搜尋「Add EXIF and IPTC meta data to Attachment Post」→ 直接安裝(推薦)
原文外掛簡介
WordPress extracts image meta data from a file when it is uploaded and adds it to the newly created Attachment Post in the database. This Plugin extracts and saves a much wider range of EXIF and IPTC information than WordPress Core usually stores.
This Plugin currently supports JPEG and WEBP files.
This plugin does not output any data on the website or in the WordPress Admin area. If this is required, a developer will need to amend the Theme or Plugin which generates the HTML for the website.
The Plugin does not add any information to Attachment Posts which have already been created. (The Plugin does, however, update the stored meta data when a new image is uploaded to an existing Attachment Post; for example when the Enable Media Replace Plugin is used.)
The information is not visible in the Media editor, but is available to developers when using the wp_get_attachment_metadata function. The data is stored in a subset of the array returned by this function, within the array key shp_additional_metadata.
e.g.
