WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Function Reference/wp prepare attachment for js"

m (Changelog: Link version 3.5)
(Include more information about the function)
Line 1: Line 1:
 
== Description ==
 
== Description ==
   
What it does
+
Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model.
   
 
== Usage ==
 
== Usage ==
   
%%% <?php ?> %%%
+
%%% <?php wp_prepare_attachment_for_js( $attachment ) ?> %%%
   
 
== Parameters ==
 
== Parameters ==
  +
  +
{{Parameter|$attachment|mixed|Attachment ID or object.}}
  +
  +
== Return Value ==
  +
  +
{{Return||array|Array of attachment details.}}
   
 
== Examples ==
 
== Examples ==
Line 19: Line 25:
 
== Source File ==
 
== Source File ==
   
<tt> </tt> is located in {{Trac| }}
+
<tt>wp_prepare_attachment_for_js()</tt> is located in {{Trac|wp-includes/media.php}}.
   
 
== Related ==
 
== Related ==

Revision as of 17:32, 12 December 2012

Description

Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model.

Usage

 <?php wp_prepare_attachment_for_js$attachment ?> 

Parameters

$attachment
(mixed) (required) Attachment ID or object.
Default: None

Return Value

(array) 
Array of attachment details.

Examples

Default Usage

Change Log

Source File

wp_prepare_attachment_for_js() is located in wp-includes/media.php.

Related