• Resolved coachigdon

    (@coachigdon)


    My site was upgraded to WordPress 4.0, and after that I am unable to access any of the edit features of the site. It gives me this error.
    Fatal error: Call to undefined function get_current_screen() in /home/coachigdon/arlrooftop.com/wp-content/plugins/food-and-drink-menu/cpts.php on line 604
    I have tried restoring from backup on Dreamhost and via FTP from the .old directory. Neither fixes the issue. Line 604 is this.
    $screen = get_current_screen();
    followed by these 2 lines
    if ( $screen->post_type == FDM_MENUITEM_POST_TYPE && !empty( $_GET[‘section’] ) ) {
    $section = (int) $_GET[‘section’];

    Can anyone suggest how I can either clean up the cpts.php file, or how I might recover my edit capabilities?

    https://wordpress.org/plugins/food-and-drink-menu/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Coachigdon,

    I’m really sorry to hear that. The plugin was tested on 4.0 before the update, but unfortunately I’m not able to replicate the problem. I run 4.0 with the plugin and don’t have any issues on edit screens.

    Recent work I’ve been doing to improve compatibility with WPML has exposed a similar issue. This leads me to believe that there might be a conflict with one of your plugins — perhaps something that interacts with the filters available on posts?

    The quick and dirty way to restore access for you is to find line 604 of cpts.php and add the following right ABOVE it:

    if ( !function_exists( 'get_current_screen' ) ) {
      return;
    }

    However, this won’t solve the root cause. If I find it’s a problem with my code, I’ll ship it in the next update. But if it’s a conflict with a plugin that is doing things the wrong way, it may not get included in my next update. The real issue here is why this hook is getting called in a context in which get_current_screen() is not available. As I understand the hook, it shouldn’t ever get called except on normal post list tables.

    Thread Starter coachigdon

    (@coachigdon)

    Thank you for your prompt reply. I will try your workaround.
    That will then let me try and figure out the root cause. I need to clean up and remove any plug ins I am not using.
    Thanks again. I love the plug in.

    Thread Starter coachigdon

    (@coachigdon)

    Thanks again, the code snippet worked. I will see if I can figure out the cause of this problem when the code is not there.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress 4.0 upgrade broke my edit capabilities’ is closed to new replies.