WordPress.org

Ready to get started?Download WordPress

Forums

Media Category Library
[resolved] Fatal Error! (8 posts)

  1. Marvin P.
    Member
    Posted 1 year ago #

    Fatal error: Call to undefined function get_current_screen() in /home/user/public_html/wp-content/plugins/media-category-library/classes/media-category-library.php on line 161

    http://wordpress.org/extend/plugins/media-category-library/

  2. c3iq
    Member
    Posted 1 year ago #

    Me too.

    I'm running 3.5.1 with multisite and Buddy Press. I'll test with a previous version and feedback.

    [edit] Should have said it breaks admin pages only.

  3. c3iq
    Member
    Posted 1 year ago #

    I added this:

    require_once(ABSPATH . "wp-admin/includes/screen.php");

    to the top of wp-content/plugins/media-category-library/classes/media-category-library.php as per http://wordpress.org/support/topic/fatal-error-when-going-to-wp-admin?replies=5

    This brings the website admin back.

  4. SCNisHere
    Member
    Posted 11 months ago #

    This solved the same issue for me. @c3iq, thanks for posting the fix.

  5. timmcdaniels
    Member
    Plugin Author

    Posted 11 months ago #

    The new version (1.9) addresses this issue. It was a problem with WP 3.5.1 and before, I believe.

  6. ernietamminga
    Member
    Posted 11 months ago #

    Just installed version 1.9, and it (re-)caused the fatal error, which I had previously fixed in the earlier version by inserting the "require_once" command as noted above.

    Fortunately the fix of adding "require_once" still fixes the re-caused problem in version 1.9.

  7. Stefan Boonstra
    Member
    Posted 10 months ago #

    The function 'get_current_screen()' doesn't exist from the very start when the plugin is initialized. That's why it's good practice to check whether or not the function exists before using it.

    function_exists()

  8. timmcdaniels
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Stefan,

    I had done that for one function call, but I missed the other function call later in the code. I do this for both function calls:

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

    Would you mind trying again to make sure the new version fixes this for you. Also, what version of WP are you running?

    Thanks,

    Tim

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic