Setting/unsetting terms using the Backbone JavaScript client
Setting/unsetting terms using the Backbone JavaScript client
Setting/unsetting terms using the Backbone JavaScript client
wp.template() returns tags in Ajax response
Accessing user Meta data via REST and backbone
rendering view in backbone
Use the backbone.js client to save custom post type meta
Media Library Grid View Custom Filter
After digging through the media modal code, I came up with the answer to my question: wp.media.controller.Custom = wp.media.controller.State.extend({ initialize: function(){ this.props = new Backbone.Model(); }, // called when the toolbar button is clicked customAction: function( controller ){ // get the value of a media view template form field using // this.props.get(‘key’), where ‘key’ is … Read more
if (wp.media) { wp.media.view.AttachmentCompat.prototype.on(“ready”, function (e) { console.log(“Kompat Ready mokor 12″); }); } This event name is “ready” 🙂 works now fine . Maybe this will help someone.
fetch returns a promise, so you want to wait until the promise is resolved. For example: new wp.api.models.Post( { id: 1 } ).fetch().then( console.log ); or doing something with the data: new wp.api.models.Post( { id: 1 } ).fetch().then( post => { console.log( post ); } ); To address your comment, Promises are async – so … Read more
As of 4.1.1, the nonce is defined in wp-includes/media.php, line 2883: $settings[‘post’] = array( ‘id’ => $post->ID, ‘nonce’ => wp_create_nonce( ‘update-post_’ . $post->ID ), ); So to verify the nonce: wp_verify_nonce( $nonce, “update-post_$post_ID” );