Can anyone think of a good starting point of how I could create a simple browser extension to allow submitting of posts to my wordpress website.

At the moment, the user can login and via the front end submit posts to their profile.

What they are submitting is actually their favourite websites. So.. I want to try and create a browser extension that enables this whilst visiting other websites, like a super slick bookmarking tool.

Very vague question I know, and I am sure will be a bit tricky to achieve but I was just wondering if anyone had any ideas of at least a starting point for me to go on!

Thanks guys,



Leverage the REST API for extension/WordPress communication.


As discussed in the comments, creating custom AJAX handlers is probably a more straightforward and "more simple" approach.

In order to implement your project using the REST API, you would likely have to implement a custom post type as well as a custom REST endpoint controller class. Using a simple AJAX approach, however, you only need implement a AJAX controller.

As an alternative to implementing a heavier browser extension, you might also consider implementing a bookarklet instead - that is, a chunk of JavaScript code which is executed through a browser's address bar, and thus can be saved in virtually any web-browser as a "bookmark". This is how the "Press This" feature shipped with WordPress functions.

In either scenario, it's possible that you'll need to configure the endpoint(s) which communicates with the extenstion/bookmarklet to allow HTTP requests originating from virtually anywhere. An HTTP request to a server originating from another domain than the server itself is commonly called a "Cross-Origin-Request", which is managed through web-server and application rules regarded as "Cross-Origin Resource Sharing" or "CORS"

  • why so difficult when you can do a bookmarklet? Anyway the API is unlikely to be able to provide the needed facilities out of the box – Mark Kaplun Mar 23 '17 at 4:53
  • @MarkKaplun I've never really used the bookmarklet, it totally slipped my mind! Working off of the bookmarklet would definitely probably be the easier solution. But what facilities are you referring to? Beyond a few modifications to CPT registration or the creation of a custom endpoint, I'm not sure what else would stand in the way... Unless cookie authentication creates a problem? – bosco Mar 23 '17 at 5:08
  • yeh, the question is somewhat broad, so depends if you want just a "share this" type of thing or a full blown UI. I think a bookmarklet can still run JS that send ajax request.... feedback to the user might be harder but probably possible..... and the big advantage over a "browser app" is that bookmarklets work on all browsers. – Mark Kaplun Mar 23 '17 at 5:15
  • as for rest API shortcomings, it fully reflects the admin, and anything that is not by default in the admin requires extra coding. From my POV, if you are going to do extra coding you might be better skipping the REST API and just register your own json route and handle the requests comming on it – Mark Kaplun Mar 23 '17 at 5:16
  • We're getting closer to universal browser extensions - you can already write some breadth of simpler extensions which will work in Chrome, Opera, Firefox, Edge and a few others. But it's still years off - your point stands strong. I think AJAX in bookmarklets should work fine, if the request doesn't trigger a CORS preflight (form-data, maybe?) or the relevant endpoint has permissive request origins configured. I don't understand how "Press This" handles authentication (unless it just redirects you?) - but I guess it's probably something worth learning =] – bosco Mar 23 '17 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.