-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Widgets editor] is_admin() is false in the API requests to /wp/v2/widget-types #33462
Comments
Related: #33454 (comment), #33443 Interestingly, this is a case of this @hellofromtonya :
Here's the problem: Here's the stack trace from the plugin function that registers the hooks (note
Here's the stack trace from
So it's something initiated in the line 13 of wp-blog-header ( The two ways forward I can think of here are:
cc @noisysocks @hellofromtonya @kevin940726 @draganescu @TimothyBJacobs |
Thank you guys for having a look into this. I'm pretty amazed and happy about this. |
Yeah this would be a documented breaking change. There were similar issues when the block editor was originally introduced in 5.0. |
Hello @noisysocks . I saw you closed this issue. May I ask if it is solved? |
@codestylist I think the consensus is not to solve this one, just document that it is a breaking change and recommend an alternative. I am not sure if conditionally registering form hooks depending on |
Thank you @adamziel for explaining it. I understand. So, I will double check on my end and find another way to handle this. |
Thank you @codestylist ! For context here is the discussion around the potential fix and the conclusion to revert on that path. 🚀 |
Thank you @draganescu for pointing me to the slack discussion. In my opinion the explained issue is not the reason for problems with my plugins. Do you recommand to open a new issue for this behavior? |
@codestylist I opened an issue for that: #33540 |
Thank you @adamziel . Thank you very much for your effort. |
Description
The plugin Widget Visibility Time Scheduler registers the
in_widget_form
callback to augment the widget editing form. It does so indefine_admin_hooks
function which is called like this:Unfortunately,
is_admin()
is false in context of/wp/v2/widget-types
.Step-by-step reproduction instructions
Expected behaviour
Additional form fields rendered:
Actual behaviour
No additional form fields rendered:
The text was updated successfully, but these errors were encountered: