您的当前位置:首页 > 知识博客 > wordpress建站

WordPress为JS准备附件对象函数:wp_prepare_attachment_for_js

时间:2024-03-12

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.tiezhushuo.com/wp-content/uploads/2020/05/baidusrf-for-linux.webp
    [link] => https://www.tiezhushuo.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.tiezhushuo.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.tiezhushuo.com/wp-content/uploads/2020/05/baidusrf-for-linux-320x200.webp
                    [orientation] => landscape
                )

            [full] => Array
                (
                    [url] => https://www.tiezhushuo.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

相关函数:

  • get_media_states()

  • wp_get_original_image_url()

  • wp_get_original_image_path()

  • wp_ajax_media_create_image_subsizes()

  • wp_ajax_crop_image()

  • wp_ajax_upload_attachment()

  • wp_ajax_get_attachment()


欢迎咨询/Welcome to inquire
tel/vx:18842938855
qq:1685522781
email:1685522781@qq.com

Copyright © 2019-2024 jsp.hk


Whatsapp