Skip to main content

Questions tagged [backbone]

JavaScript library with models, collections and views. Requires Underscore.js or Lo-Dash.

Filter by
Sorted by
Tagged with
0 votes
1 answer
36 views

How to get posts in backbone where a custom field matches a value?

How can I retrieve posts, using backbone, that match a particular custom field value? My custom fields are created through ACF. Something like this doesn't work: var data = { offset: 0, ...
MastaBaba's user avatar
  • 291
1 vote
1 answer
34 views

Using backbone, can I prevent the nonce from being set?

I'm using backbone in my website to access the Wordpress API. This works very nicely. However, it is my understanding that backbone always sends a nonce with each request. This appears to be ...
MastaBaba's user avatar
  • 291
0 votes
0 answers
154 views

WordPress REST API and Backbone JS

I am trying to learn WordPress Rest API using Backbone.js the official library, there aren't many tutorials, and that's why I am asking this question right here. First question is why when I add WP-...
Kristijan Pirkovic's user avatar
1 vote
0 answers
52 views

Is there any halfway decent documentation on the wp.media JS class?

Sorry for the somewhat rambly question, but has anyone ever seen any good piece of documentation, or maybe even a tutorial on the wp.media JS class? All that i could find documentation-wise is this ...
TimMKuehle's user avatar
0 votes
0 answers
119 views

Extend backbone for add new custom Rest Api

I would like to know how i can extend the backbone from wordpress to be able to add custom rest api? I have created a wp-extend-core/v2/themes-generated endpoint, and to be able to use it in admin I ...
Blaga Vasile-Alexandru's user avatar
1 vote
1 answer
81 views

Can I use the Backbone REST API client outside WordPress?

I'm starting to develop a new little js app that consumes a WordPress REST API. The new client app will not be on the same WordPress installation (let's assume that will be a simple JS script hosted ...
Stefano's user avatar
  • 1,261
1 vote
1 answer
128 views

How to limit what fields are returned through the WP API Backbone JS client

If I fetch data from the WP JSON API via a URL, I can specify in the URL what fields should be returned. How can I do this when using Backbone JS? I would expect it to be something like this: ...
MastaBaba's user avatar
  • 291
0 votes
1 answer
104 views

Programtically selecting image URL in Media Library modal

I've been struggling with Backbone for a few hours now while I'm trying to select a custom image URL in the media modal. The idea is to have a button that I've coded already and when the user clicks ...
Hardeep Asrani's user avatar
1 vote
0 answers
648 views

Media Library Grid View Custom Filter

I'm trying to use the Backbone, customizing the Author Filter in media library grid view. I found lots of information on the Internet, and create filter on the toolbar. But there is one error I can't ...
Tunglin Li's user avatar
0 votes
0 answers
48 views

Check if user can in javascript

Using the rest API I retrieve a collection of posts: const recordsParams = {} const recordsCollection = new wp.api.collections.MyPostType(); recordsCollection.fetch( { data: recordsParams } ) ....
Laurent's user avatar
  • 214
1 vote
1 answer
588 views

wp-api Backbone JS Client fetch options

I’m making a webapp based on wordpress in which I’m using the REST API for my users to get and create posts. I found the very useful REST API backbone javascript client which seems great. However the ...
PaddleStroke's user avatar
1 vote
0 answers
152 views

Use the backbone.js client to save custom post type meta

So I have this small piece of code that renders an array of IDs: const selected = this.$data.list.selected; function get_ids(input, field) { const output = []; for (let i=0; i < input....
Tripp's user avatar
  • 13
0 votes
1 answer
346 views

URL issue retrieving Custom Post Types using Backbone JS API

I have a Custom Post Type called pronews. I registered it with show_in_rest enabled. I'm using WordPress 5.5. I then have this code: export const ProPost = wp.api.models.Post.extend( { urlRoot: ...
Laurent's user avatar
  • 214
0 votes
1 answer
69 views

Access checks with custom REST endpoints and backbone

I have created a plugin in with several custom REST endpoints. However I can not get the permission callbacks to work. Current user is always '0'. I'm using localize script to send the nonce. ...
dsj's user avatar
  • 63
0 votes
0 answers
364 views

Insert HTML markup to page content from the Media Frame modal

TL;DR How do I get the HTML markup created in the Media Frame modal and insert it into the editor/page content? I'm trying to insert media from a custom router-tab in the media frame. But I have no ...
Mads Hansen's user avatar
2 votes
1 answer
1k views

Add custom post type to Backbone collections

I am trying to fetch posts of a custom post type (cpt) with the backbone js client. I registered the cpt with the show_in_rest param set to true. I enqueued the wp-api script. The url http://myweb....
Marc's user avatar
  • 357
1 vote
0 answers
33 views

rendering view in backbone

I'm attempting to write a plugin that will present a mostly pre-filled out form with a custom header. I've created a RESTful endpoint to supply and receive the data. And I've created a Model in ...
dsj's user avatar
  • 63
0 votes
1 answer
416 views

Backbone with custom rest endpoints

I have created a custom endpoint that returns select user meta data. I am trying to access this endpoint with Backbone. It works as expected in Postman and from my Backbone/javascript script If I have ...
dsj's user avatar
  • 63
1 vote
0 answers
277 views

Accessing user Meta data via REST and backbone

I'm writing a plugin to allow users to update information stored in wp_usermeta. I'm trying to use the Backbone JavaScript client with REST. I have the HTML code. <div id="container">Loading......
dsj's user avatar
  • 63
1 vote
1 answer
476 views

backbone fetch() not working

I'm trying to use the REST API with Backbone in a plugin. I'm working through the documentation and examples at: https://developer.wordpress.org/rest-api/using-the-rest-api/backbone-javascript-client/....
dsj's user avatar
  • 63
1 vote
0 answers
67 views

wp.template() returns <script> tags in Ajax response

I'm using the wp.template() to create a BackBone JS template which comes with WordPress by default. I have a template defined as: <script type="text/html" id="tmpl-pre-registration"> <...
Siddharth Thevaril's user avatar
1 vote
0 answers
70 views

Setting/unsetting terms using the Backbone JavaScript client

I'd like to set and delete terms in my custom taxonomy using the WordPress Backbone JavaScript client, which provides access to the REST API in JavaScript. I can't find an example or suggestion in ...
Sean's user avatar
  • 647
0 votes
1 answer
2k views

How to render WP Rest-API Endpoints in a React.js Theme with Woocommerce

I am building a Ecommerce Wordpress/Woocommerce Theme using React.js. I am using the npm package: create-react-wptheme This package renders the react app directly inside of the index.php of the ...
Toni Wheeler's user avatar
1 vote
1 answer
131 views

Backbone event attachment:compat:ready can't hook

I want to ask question about events in backbone. I have problem to run some function when hook is triggerd. I want to wp.media.view.AttachmentCompat.prototype .on("attachment:compat:ready", ...
PawelC's user avatar
  • 21
2 votes
1 answer
1k views

Rest API invalid nonce with Backbone Client

I'm using the built-in Backbone Client whenever I try to make a request it gives me this error: {"code":"rest_cookie_invalid_nonce","message":"Cookie nonce is invalid","data":{"status":403}} I read ...
Rick Stanley's user avatar
0 votes
0 answers
127 views

Wordpress Media Uploader : How to add custom button on featured image tab

We are working on the plugin and try to add a custom button near 'set featured image' but we can not able to find out any solution or clue how to add it using media library function. Can someone ...
Bhushan Gohel's user avatar
0 votes
1 answer
396 views

Am I able to change the name of /wp-admin/options-general.php?

I'm asking this question because I am coding a Wordpress plugin, and I want to be able to detect when WP-Admin is using options-general.php. Currently, I'm just checking the URL directly to see if it ...
John Doe's user avatar
  • 287
0 votes
1 answer
42 views

Minimum version for Wordpress Backbone

How do I find the minimum Wordpress version required if I want to use Backbone on a plugin? I'm building a Wordpress plugin, and I can't find documentation online that records when Wordpress first ...
John Doe's user avatar
  • 287
6 votes
2 answers
11k views

How does REST API cookie authentication work in WP 4.7?

Though I have logged in, I cannot create a post on frontend. WordPress always return 401 Unauthorized response. I have dumped $_COOKIE to make sure logged-in cookie was set and got something like this:...
Minh Tri's user avatar
  • 3,419
0 votes
1 answer
365 views

Render repeatable widget fields properly with Backbone.js

I wanted to create widgets with repeatable fields for testimonials, time tables etc.. I recently stumbled up on this tutorial from codeable.io. I have some good experience with standard backbone.js ...
Naresh Devineni's user avatar
8 votes
4 answers
12k views

Show only images and videos in a wp.media window

I'm using the following JS code to open a wp.media window to allow users to select images and videos for a gallery. Everything is working as expected, but I'm unable to restrict the window to show ...
leemon's user avatar
  • 1,928
2 votes
0 answers
647 views

Add guid filter to attachment in media library grid mode

I'm trying to show in media modal box, attachments from a specific folder in my website and, correct me if I'm wrong, the best way to proceed is a like filter on wp_posts field GUID. Something like ...
user114036's user avatar
3 votes
2 answers
1k views

Is dynamic forms/entries possible in Widget?

I am new to WordPress Plugins development, and I just started working with the widget. My question is: What are the limitations of WordPress Widget? I tried to use jQuery to make the Widget Form more ...
Sengngy Kouch's user avatar
1 vote
0 answers
367 views

How to submit data between wp_iframe and backbone.js in media upload

In short: On a post/page edit.php I want to be able to click Add media and open the default media uploader instead of Create Gallery on the left-side menu there is a custom tab. on this custom ...
Bardock's user avatar
  • 11
1 vote
0 answers
36 views

Mapping Backbone Models to serialized array in wp_options table

I want to create a to do list to use Backbone in the context of WordPress, and i want to save models as single serialized array via update_option(), the problem is that i don't know how to mappe the ...
Elidrissi simo's user avatar
1 vote
4 answers
5k views

How to Dequeue All WordPress Assets

I want to dequeue all styles and scripts that are loaded on the front-end (EG. not the admin panel) by default. I found this function, but am not sure how to utilize it to accomplish my goal. I'm ...
Ken Prince's user avatar
2 votes
1 answer
545 views

WP theme with Backbone

What would be the best way to insure that a Backbone WP theme cooperates with standard shortcodes and other WP plugins that include script and style tags in header and footer. I know Backbone plays ...
steakoverflow's user avatar
6 votes
1 answer
3k views

Open media frame and select an attachment

I'm using the following piece of code to open a media frame when clicking a link with a data-attachment_id attribute. This attribute holds the id of an attachment that I want to select when the frame ...
leemon's user avatar
  • 1,928
4 votes
1 answer
970 views

Using the REST API (v2) javascript client on a private namespaced route

I am using the latest version of the REST API plugin in a project and I've added my routes to a separate namespace (as recommended in the documentation). The javascript client included with the API ...
Dalton Rooney's user avatar
1 vote
0 answers
297 views

Is there a media_upload_tabs-similar filter to add tabs to the simple/featured image picker?

There's something I have been wondering about the media_upload_tabs filter that lets you create new image insert sections to the add-media modal in Wordpress editor inserter. Oddly enough it seems it ...
NoBugs's user avatar
  • 452
7 votes
1 answer
2k views

Add custom class to attachment in media library grid mode

In the above screenshot we are in the media library with grid mode active. I want to add a custom class depending on the attachment filter wp_prepare_attachment_for_js. For example i hook to the ...
Matthias Günter's user avatar
0 votes
1 answer
720 views

WP-API + JS Backbone client - how to update post meta

Using the WP API and Backbone-based JS client, I'm trying to update a post's metadata as follows: var parentId = 96; // the post id var metaData = new wp.api.collections.PostMeta('', {parent: ...
pdme's user avatar
  • 292
3 votes
1 answer
893 views

What type of template are WP media-modal's templates?

I was looking at the Wordpress templates (html that's written to the page instead of awkwardly adding strings in JS). There are a lot of templates like this in a post editor for example: <script ...
NoBugs's user avatar
  • 452
0 votes
2 answers
2k views

Hook into backbone to add js to wp-admin -> media library?

I've enqueued a .js file on the "Media Library" page (upload.php). I need to hide and manipulate a few of the thumbnails on the page using JS only ( I'm not looking for workarounds ). The elements ...
Dorian Tudorache's user avatar
5 votes
1 answer
463 views

How could I add button next to "edit image" button in "Attachment Details"

How could I add button next to "edit image" button in "Attachment Details" This is the location I would like to add button, Do you have any recommend?
KKND_BLACK's user avatar
13 votes
1 answer
921 views

Modified wp.media.view.Settings.Gallery in Backbone JS, but editing doesn't work

I've added to the normal WordPress gallery popup (when clicking "Add Media" in the WordPress editor), in order to allow my custom gallery type to be selected (which interacts with / uses the main ...
Lloyd Jones's user avatar
2 votes
1 answer
459 views

Adding fields to the media uploader with jquery listeners

So I have the code to successfully add a select field to my media uploader (gallery view) which is cool, but I also need to add some jquery listeners to that field. I'm using the '...
rugbert's user avatar
  • 168
4 votes
2 answers
1k views

Updating Post Meta with Backbone and the REST API

I'm getting started with a project that is making use of Backbone and the WP REST API, but I"m having a little trouble. Using the built in API JS for models and collections allows me to pretty easily ...
Jason Hoffmann's user avatar
1 vote
1 answer
709 views

How to check an ajax nonce in PHP

I'm modifying the media modal adding a new menu item to add external attachments to the media library. From the JS code I'm calling a PHP function that touches the database and accepts three ...
leemon's user avatar
  • 1,928
1 vote
1 answer
514 views

How to retrieve a value from an input field in a media view template

I've created a media view template with two input fields (width and height) and I was wondering how to retrieve the values entered in them in a media controller o view. PHP: function ...
leemon's user avatar
  • 1,928