Skip to content

5.1.1: PHP Fatal error: Uncaught Error: Call to undefined function use_block_editor_for_post() in wp-content/plugins/gutenberg/lib/register.php:36 #14012

Closed

Description

Describe the bug
It's related to deprecated gutenberg_can_edit_post().

I was using Toolset Views conditional shortcode like follows: [wpv-conditional if="( gutenberg_can_edit_post( [wpv-post-id] ) )"]

This, very recently (either core 5.1rc2, or Gutenberg plugin 5.1.0 release) started crashing, after working error free for nearly a year.

Traceback:

[21-Feb-2019 14:39:30 UTC] PHP Notice:  gutenberg_can_edit_post is <strong>deprecated</strong> since version 5.0.0! Use use_block_editor_for_post instead. in /wp-includes/functions.php on line 4329
[21-Feb-2019 14:39:30 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function use_block_editor_for_post() in /wp-content/plugins/gutenberg/lib/register.php:36
Stack trace:
#0 /wp-content/plugins/wp-views.git/embedded/inc/wpv-condition.php(707): gutenberg_can_edit_post('839489', 'posts', Object(WP_Post))
#1 /wp-includes/class-wp-hook.php(286): wpv_add_wpv_if_functions_support('( gutenberg_can...')
#2 /wp-includes/plugin.php(208): WP_Hook->apply_filters('( gutenberg_can...', Array)
#3 /wp-content/plugins/wp-views.git/embedded/inc/wpv-conditional.php(830): apply_filters('wpv-extra-condi...', '( gutenberg_can...')
#4 /wp-content/plugins/wp-views.git/embedded/inc/wpv-conditional.php(684): WPV_Views_Conditional::parse_conditional(Object(WP_Post), '( gutenberg_can...', false, Array, 839489, true)
#5 /wp-includes/shortcodes.php(325): WPV_Views_Conditional->wpv_shortcode_wpv_conditional(Array, '\n<a class="post...', 'wpv-conditional')
#6 [internal f in /wp-content/plugins/gutenberg/lib/register.php on line 36

Expected behavior
gutenberg_can_edit_post() should be able to forward to use_block_editor_for_post() from all angles.

Additional context
It's weird, because use_block_editor_for_post() is defined in wp-admin/includes/post.php and I would expect that to be always loaded, right...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    [Type] BugAn existing feature does not function as intended[Type] RegressionRelated to a regression in the latest release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions