首页>文档>Wordpress开发文档>Wordpress 函数>wp_prepare_attachment_for_js()

wp_prepare_attachment_for_js()

WordPress为JS准备附件对象函数

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.zz2zz.com/wp-content/uploads/2020/05/baidusrf-for-linux.webp
    [link] => https://www.zz2zz.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.zz2zz.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.zz2zz.com/wp-content/uploads/2020/05/baidusrf-for-linux-320x200.webp
                    [orientation] => landscape
                )
 
            [full] => Array
                (
                    [url] => https://www.zz2zz.com/wp-content/uploads/2020/05/baidusrf-for-linux.webp
                    [height] => 430
                    [width] => 768
                    [orientation] => landscape
                )
 
        )
 
)

扩展阅读

wp_prepare_attachment_for_js()函数位于:wp-includes/media.php

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索