skip to Main Content

when I go in wp-admin into Pages and try to edit existing page (by click on page name or Edit) then I will get this error mentioned below. Do you know how to solve it, please?

Fatal error: Uncaught Error: Call to undefined function wp_theme_has_theme_json() in /home/users/galanterieroznov/masaze-roznov.jednoduse.cz/web/wp-admin/edit-form-blocks.php:206 Stack trace: #0 /home/users/galanterieroznov/masaze-roznov.jednoduse.cz/web/wp-admin/post.php(187): require() #1 {main} thrown in /home/users/galanterieroznov/masaze-roznov.jednoduse.cz/web/wp-admin/edit-form-blocks.php on line 206http://masaze-roznov.jednoduse.cz/enter image description here

I have tried to make backup of wp site. Then I reset WP site and restore it, however it did not work so far.

2

Answers


  1. The wp_theme_has_theme_json() function has been introduced from WordPress 6.2.0 as reported here, so i suggest you to check your current WordPress version and if possible to update it.

    If you can’t update, you can try to copy and paste the source code of the function in your theme or in a plugin created by you, drawing from the link I indicated

    Login or Signup to reply.
  2. wp_theme_has_theme_json function is introduced in WordPress 6.2

    • Change the theme to WordPress default theme (Twenty Twenty-Three).
      Issue should be resolved. If not, deactivate all plugins. Update WordPress to 6.2 . Create a new page and then edit. If issue still occurs then it is probably a core issue (report to https://core.trac.wordpress.org/). Or, consult support first (https://wordpress.org/support/forums/)

    • If issue gets resolved by changing the theme to WordPress default theme, then issue with your custom theme. Theme author need to call the function properly by checking whether this function is available or not. Theme is not compatible with lower version of WordPress (as it is forcefully using a function from WordPress 6.2).

    I believe updating to WordPress 6.2 will fix the issue. Otherwise search the function in your theme and add a check

    if ( function_exists( 'wp_theme_has_theme_json' ) ) { 
      // your code
    } 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search