Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of all available JavaScript wp.hooks? #7712

Closed
katerlouis opened this issue Jul 4, 2018 · 9 comments
Closed

List of all available JavaScript wp.hooks? #7712

katerlouis opened this issue Jul 4, 2018 · 9 comments
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Type] Developer Documentation Documentation for developers

Comments

@katerlouis
Copy link

I want to alter the "Status & Visibility" area for normal posts and disable/hide the "stick to front page" checkbox.

a post in #6533 suggests to use withFilter to alter / remove existing UI elements in Gutenberg.

But I can't find what hook would filter this ui part, or if there even is a hook for that.
Is there a list with all available hooks?

wp.hooks in Chromes console also didn't reveal the hooks to me :'(

@Soean Soean added [Type] Developer Documentation Documentation for developers [Feature] Extensibility The ability to extend blocks or the editing experience labels Jul 4, 2018
@ajitbohra ajitbohra added this to the Documentation & Handbook milestone Oct 4, 2018
@youknowriad youknowriad removed this from the Documentation & Handbook milestone Mar 18, 2019
@leomuniz
Copy link
Contributor

leomuniz commented Apr 3, 2019

This is still a thing. Hooks are the most primary concept in Wordpress and I can't find anywhere which hooks are available so I can extend/modify Gutenberg. Inside documentation, there are some hooks spread through methods. But I would need to read all docs to understand my possibilities (and it's possible that some of them are missing).

@youknowriad
Copy link
Contributor

hooks are not considered a primary concept in terms of JavaScript extensibility. The consensus in the core javascript chats after month exploring them is that we should avoid using/adding hooks in JavaScript and favor more targetted extensibility APIs.

@katerlouis
Copy link
Author

I see, I see–

the situation is quite difficult in that case; you want to go into another direction, which takes time, but we, the developers, need to work with gutenberg today. Clients don't understand / accept that things take longer now, because Gutenberg is still rough and very hard to work with, when you want to dig deep. In fact, you don't even have to dig that deep.. some things that used to be quite easy "back in the day", are hard now and often require workarounds.

@youknowriad
Copy link
Contributor

Let's go into the specifics instead. If you have a particular need for an extensibility APIs that's not available, open an issue so we can discuss it.

@leomuniz
Copy link
Contributor

leomuniz commented Apr 3, 2019

Thank you guys for being patient. :) I may be thinking with old Wordpress way of doing things. And I'll try to get better on this.

Well, there are many things that I need to address:

  • Verify if a post was published (I'm going to subscribe() but I didn't test yet)
  • Filter some labels to change them: I want to change all Publish labels and its variations, as the Document title on the metabox sidebar and the Status & Visibility title.
  • Remove some things from sidebar panels, like: Visibility (I want it always Public); the Pending Review option and Move to trash button.

Unfortunately I'm really in trouble on how to accomplish these things. hahah But I'll keep trying :)

@youknowriad
Copy link
Contributor

Aside, the first one, these things sound like good separate issues. I don't think we should expect to be able to change anything that's on the page though, so some of these items might be "rejected" but at least this could be discussed properly. Also, it's always good to explain the "why" behind these use-cases. Why do you want to change "publish" labels, why do you want to remove the "trash" button... this helps clarify the use-cases and shape the APIs.

@leomuniz
Copy link
Contributor

leomuniz commented Apr 5, 2019

As you can see above I've created an issue explaining the use-case and asking more information on how to accomplish these things.
Thank you very much

@lgersman
Copy link

lgersman commented Feb 12, 2021

The easiest way to get the list of available wp.hooks actions and filters :

  • open a page or post in gutenberg editor
  • open the js browser console
  • enter wp.hooks.actions for the list of known actions
  • enter wp.hooks.filters for the list of known filters

Thats it.

Since wp.hooks is not bound to Gutenberg you can use the procedere even on the wordpress dashboard or wherever wp.hooks was loaded.

@mtias
Copy link
Member

mtias commented Jul 13, 2021

There's also https://developer.wordpress.org/block-editor/reference-guides/filters/. Anything specific missing should be added there as new issues.

@mtias mtias closed this as completed Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

No branches or pull requests

7 participants