Okay
  Public Ticket #4516857
Fatal Error: MarketKing Redeclaring get_current_screen() (Conflicts with WordPress Core)
Open

Comments

  • Mendel Rosenblum started the conversation

    Hi team,

    I'm experiencing a critical PHP fatal error caused by MarketKing redeclaring the core WordPress function get_current_screen(). This is breaking wp-admin on my live site.

    Full error:

    PHP Fatal error: Cannot redeclare function get_current_screen() (previously declared in /nas/content/live/tovahmarket/wp-content/plugins/marketking-multivendor-marketplace-for-woocommerce/public/dashboard/marketking-dashboard-login.php:2203) in /nas/content/live/tovahmarket/wp-admin/includes/screen.php on line 224
    

    It appears that MarketKing is defining get_current_screen() inside:

    /public/dashboard/marketking-dashboard-login.php (around line 2203)
    

    WordPress already defines this function inside core (wp-admin/includes/screen.php), so the plugin should not declare it again. Standard practice is to wrap such declarations in a conditional:

    if ( ! function_exists( 'get_current_screen' ) ) {    function get_current_screen() { ... }
    }
    

    This bug is causing a hard crash and locks me out of admin pages.

    Can you please issue a fix or provide a patched file?

    A temporary conditional wrapper works, but I’m trying to avoid modifying plugin files directly so updates don’t overwrite it.

    Please advise on the correct fix or provide an updated version of the plugin.

    Thanks!