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

wp_prepare_attachment_for_js()

WordPress为JS准备附件对象函数

WordPress函数wp_prepare_attachment_for_js为JS准备附件对象,包含了附件的所有信息。

  1. wp_prepare_attachment_for_js( int|WP_Post $attachment )

函数参数

$attachment

整数或WP_Post对象

附件的ID或对象

函数返回值

  1. Array
  2. (
  3. [id] => 3163
  4. [title] => baidusrf-for-linux
  5. [filename] => baidusrf-for-linux.webp
  6. [url] => https://www.zz2zz.com/wp-content/uploads/2020/05/baidusrf-for-linux.webp
  7. [link] => https://www.zz2zz.com/2895.html/baidusrf-for-linux
  8. [alt] => 替代文本
  9. [author] => 1
  10. [description] =>
  11. => 百度输入法Linux
  12. [name] => baidusrf-for-linux
  13. [status] => inherit
  14. [uploadedTo] => 2895 //父ID
  15. [date] => 1601856000
  16. [modified] => 1601856000
  17. [menuOrder] => 0
  18. [mime] => image/webp
  19. [type] => image
  20. [subtype] => webp
  21. [icon] => https://www.zz2zz.com/wp-includes/images/media/default.png
  22. [dateFormatted] => 20201005
  23. [nonces] => Array
  24. (
  25. [update] =>
  26. [delete] =>
  27. [edit] =>
  28. )
  29. [editLink] =>
  30. [meta] =>
  31. [authorName] => admin
  32. [authorLink] =>
  33. [uploadedToTitle] => 百度输入法Linux
  34. [uploadedToLink] =>
  35. [filesizeInBytes] => 22528
  36. [filesizeHumanReadable] => 22 KB
  37. [context] =>
  38. [height] => 430
  39. [width] => 768
  40. [orientation] => landscape
  41. [sizes] => Array
  42. (
  43. [thumbnail] => Array
  44. (
  45. [height] => 200
  46. [width] => 320
  47. [url] => https://www.zz2zz.com/wp-content/uploads/2020/05/baidusrf-for-linux-320x200.webp
  48. [orientation] => landscape
  49. )
  50. [full] => Array
  51. (
  52. [url] => https://www.zz2zz.com/wp-content/uploads/2020/05/baidusrf-for-linux.webp
  53. [height] => 430
  54. [width] => 768
  55. [orientation] => landscape
  56. )
  57. )
  58. )

扩展阅读

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

0 条回复 A文章作者 M管理员
欢迎您,新朋友,感谢参与互动!
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
私信列表
搜索