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

Call to undefined function use_block_editor_for_post() in qtx_admin_gutenberg.php #1004

Closed
woutgg opened this issue Apr 9, 2021 · 7 comments
Labels
gutenberg Specific to the Block Editor (Gutenberg)

Comments

@woutgg
Copy link

woutgg commented Apr 9, 2021

While editing a page, all of a sudden previewing and updating failed due to an internal server error.
This appeared to be caused by use_block_editor_for_post() not being defined in admin/qtx_admin_gutenberg.php:61.

As mentioned in this issue comment, a require_once should be used to ensure the function is defined, and adding that indeed solves the problem for me.

@herrvigg
Copy link
Collaborator

herrvigg commented Apr 9, 2021

This is rather a bug in WP, not qTranslate. Which version are you using?

@herrvigg herrvigg added the gutenberg Specific to the Block Editor (Gutenberg) label Apr 9, 2021
@woutgg
Copy link
Author

woutgg commented Apr 9, 2021

I am using Wordpress 5.7, with qTranslate 3.9.0.

@herrvigg
Copy link
Collaborator

herrvigg commented Apr 9, 2021

In which situation does this happen?

@herrvigg
Copy link
Collaborator

herrvigg commented Apr 9, 2021

While editing a page, all of a sudden ...

Was it just once or can you reproduce this problem? Which other plugins are you using?

@herrvigg
Copy link
Collaborator

All right, this sounds quite weird but it doesn't cost much to add this preventively. I've sent a small patch now in master.

@woutgg
Copy link
Author

woutgg commented Apr 14, 2021

I agree that it seems strange. I'm not a Wordpress plugin author, but from what I gather, the require statement should indeed not be necessary in this context (i.e. admin area).

Just for (future) reference, I'll answer your questions here anyway.

I have been using the plugin for some months now (very happy with it!) and it always worked just fine.
Today I couldn't manage to reproduce the issue unfortunately. It happened while I was editing a page in the Gutenberg editor and both the preview and update buttons stopped working (nothing happened at all). Checking for console errors revealed that an XHR request was failing with a 500 status, which turned out to be this error. The same thing started happening to someone else who was editing a page as well.

Then while I was investigating the error by disabling plugins, things started working again for me (and kept working, even with all plugins re-enabled). And for the other person as well, after clearing all browser data. Soon after however, more or less the same problem returned and this time I found the source, and the 'fix' you have now added.

As far as I remember I have not added or activated any plugins before this started happening, but I might have done regular plugin updates. The active plugins are:

  • Advanced noCaptcha & invisible Captcha @6.1.5
  • Akismet Anti-Spam @4.1.9
  • Collapse-O-Matic @1.7.13
  • Editor Full Width Gutenberg @1.0.5
  • File Upload Types @1.2.1
  • Head & Footer Code @1.2.1
  • Health Check & Troubleshooting @1.4.5
  • Hello Dolly @1.7.2
  • Jetpack by WordPress.com @9.6
  • qTranslate-XT @3.9.0
  • Smart Slider 3 @3.4.1.17
  • Tracking code for Matomo, by Sergio Santos @1.1.3
  • WPBakery Page Builder @6.2.0

qwave added a commit to qwave/qtranslate-xt that referenced this issue Apr 14, 2021
* [Yoast] Add front filters schema and breadcumbs (qtranslate#947)

* Add Bangla localization files (qtranslate#960)

* Fix async events with jQuery3 (qtranslate#946)

* Anticipate qtx init before TinyMCEinit (qtranslate#946)

* Fix deprecated tinymce.editors (qtranslate#946)

* Remove ready handler from common (qtranslate#946)

With jQuery3, ready and load can be fired asynchronously.
We cannot assume ready is fired before load.
Since qtx is also initialized in load, no need for ready anymore.

* Refactor TinyMCE hook functions in common (qtranslate#978)

* Add permalink info for pre-path mode (qtranslate#821)

* Release 3.9.3

* Fix async qtx loading in ACF (qtranslate#988)

* Bundle Javascript with Webpack and Babel (qtranslate#990)

See instructions in the Pull Request.
Reactivate plugin or save settings to update the new paths in admin config.

* Minor webpack cleanup

* Bundle ACF with Webpack (qtranslate#992)

Regroup all sources into a single bundle dist/modules/acf.js.
Move and rename source files.

* Split common.js and rename to main (qtranslate#994)

* Split common.js into multiple core source files
* Rename common.js to main.js (entry and output)
* Rename qtranslate-admin-common PHP to qtranslate-admin-main
* qTranslateX class definition no longer exposed

* Refactor js var with ES6 const and let (qtranslate#996)

* Fix text variable not defined (qtranslate#995)

* Refactor ACF js with ES6 const let (qtranslate#997)

* Refactor jQuery wrappers with local alias (qtranslate#998)

* Disambiguate and rename js variables (qtranslate#1001)

* Define js constants for URL mode

* Remove unused js functions

* Minor js cleanup

* Complete js vars renaming

* Update dist js

* Delete deprecated functions in 3.7.3

* Fix qtx and repeaterFieldRemove in ACF JS (qtranslate#1006)

* Fix undefined use_block_editor_for_post (qtranslate#1004)

Co-authored-by: HerrVigg <[email protected]>
Co-authored-by: Lenin <[email protected]>
@herrvigg
Copy link
Collaborator

Release in 3.10.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gutenberg Specific to the Block Editor (Gutenberg)
Projects
None yet
Development

No branches or pull requests

2 participants