gatsbyjs / wp-gatsby

WordPress plugin for gatsby-source-wordpress
Other
167 stars 41 forks source link

Call to undefined function WPGatsby\ActionMonitor\Monitors\get_current_screen() #223

Open JohannLesacher opened 2 years ago

JohannLesacher commented 2 years ago

I'm runing into this error when saving a form created with the acf_form function. I'm runing a site with a WordPress backend, a WordPress frontend and a Gatsby frontend.

get_current_screen is a backend function and I'm using an ACF form on the WordPress frontend. The goal of this function is to check if we are on an Option page. It will always be false from de frontend of WP so I think we should add a conditionnal like :

! function_exists( 'get_current_screen')

to return early if we are not in the context of the WordPress backend.