Description
wp
is the main WordPress JavaScript object.
it is provisionned with different properties depending on what page is loaded (i.e: WordPress Dashboard)
vist each property list to see its description and on what page is provisionned.
Structure
The window.wp
object is used to namespace multiple useful Javascript class objects for WordPress's admin.
wp.a11y
- When content changes dynamically in a web page, wp.a11y.speak() can announce a message using aria-live.
wp.ajax
- Tools for sending ajax requests with JSON responses and built in error handling. mirrors and wraps jQuery's ajax APIs.
wp.apiRequest
- Thin jQuery.ajax wrapper for WP REST API requests. (since 4.9.0)
wp.autosave
- Description needed
wp.Backbone
- Description needed
wp.deprecateL10nObject
- Description needed
wp.domReady
- 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-60 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.hooks
- Description needed
wp.html
- Use for parsing HTML attributes
wp.i18n
- When registering your scripts you can add wp-i18n as a dependency to allow you to add translatable strings as you would in PHP.
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. The source is defined in
js/_enqueues/wp/media/models.js
and output in `wp-includes/js/media-models.js` during build.
wp.mediaelement
- Description needed
wp.sanitize
- Helper functions to sanitize strings.
wp.shortcode
- Utility functions for parsing and handling shortcodes in JavaScript.
wp.svgPainter
- Attempt to re-color SVG icons used in the admin menu or the toolbar
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. The source is defined in js/_enqueues/wp/util.js
and output in `wp-includes/js/wp-util.js` during build.
wp.updates
- Functions for ajaxified updates, deletions and installs inside the WordPress admin.
wp.Uploader
- Description needed
Related