WordPress为JS准备附件对象函数:wp_prepare_attachment_for_js
2022/07/13
WordPress函数wp_prepare_attachment_for_js为JS准备附件对象,包含了附件的所有信息。
wp_prepare_attachment_for_js( int|WP_Post $attachment )
函数参数
$attachment
整数或WP_Post对象
附件的ID或对象
函数返回值
Array ( [id] => 3163 [title] => baidusrf-for-linux [filename] => baidusrf-for-linux.webp [url] => https://www.beizigen.com/wp-content/uploads/2020/05/baidusrf-for-linux.webp [link] => https://www.beizigen.com/2895.html/baidusrf-for-linux [alt] => 替代文本 [author] => 1 [description] => => 百度输入法Linux版 [name] => baidusrf-for-linux [status] => inherit [uploadedTo] => 2895 //父ID [date] => 1601856000 [modified] => 1601856000 [menuOrder] => 0 [mime] => image/webp [type] => image [subtype] => webp [icon] => https://www.beizigen.com/wp-includes/images/media/default.png [dateFormatted] => 2020年10月05日 [nonces] => Array ( [update] => [delete] => [edit] => ) [editLink] => [meta] => [authorName] => admin [authorLink] => [uploadedToTitle] => 百度输入法Linux版 [uploadedToLink] => [filesizeInBytes] => 22528 [filesizeHumanReadable] => 22 KB [context] => [height] => 430 [width] => 768 [orientation] => landscape [sizes] => Array ( [thumbnail] => Array ( [height] => 200 [width] => 320 [url] => https://www.beizigen.com/wp-content/uploads/2020/05/baidusrf-for-linux-320x200.webp [orientation] => landscape ) [full] => Array ( [url] => https://www.beizigen.com/wp-content/uploads/2020/05/baidusrf-for-linux.webp [height] => 430 [width] => 768 [orientation] => landscape ) ) )