WordPress.org

Codex

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

Javascript Reference/wp

This page is marked as incomplete. You can help Codex by expanding it.

Description

The wp object is used to namespace much of WordPress's custom Javascript functionality on the admin and editor screens (e.g. Featured image upload links and editor shortcode identification).

This object can be used along with custom admin meta boxes to add functionality like custom Featured image-style image uploaders.

Structure

The window.wp object is used to namespace multiple useful Javascript class objects for WordPress's admin.

wp.Backbone 
Description needed
wp.Uploader 
Description needed
wp.ajax 
Description needed
wp.autosave 
Description needed
wp.editor 
Used to manage Rich Text, QuickTags or combined editors.
wp.heartbeat 
Used for checking whether a persistent connection is maintained with the server via pulses at constant intervals (every 15 seconds by default). Each pulse involves an AJAX request from the browser and an accompanying response from the server. This constant check, ensures that a server connection is maintained in order for several features to function properly. The Heartbeat API is used for revision tracking, auto saving, locking posts that are currently being edited by another user and more.
wp.html 
Description needed
wp.mce 
Description needed
wp.media 
Used to handle and control the admin media library. It can be leveraged to create custom image selector/uploader controls and meta boxes. This is defined by /wp-includes/js/media-models.js
wp.shortcode 
Description needed
wp.svgPainter 
Description needed
wp.template 
Create an Underscore.js _.template() function to be used to generate dynamic HTML blocks from pre-defined templates inside specially formed <script> tags. This is defined in /wp-includes/js/wp-util.js.

Related