You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug I have a plugin that relies on is_admin returning true when save_post is fired from the editor screen. The new editor does not seem to return true when is_admin is called after clicking the update button. I have tried a number of work arounds such as this function but it to fails to recognize that it is on the editor screen.
With the introduction of the REST API posts can also be created outside of wp-admin. And as said before, the new editor is using the REST API for all interactions so you have to adjust your plugin for this.
Describe the bug I have a plugin that relies on is_admin returning true when save_post is fired from the editor screen. The new editor does not seem to return true when is_admin is called after clicking the update button. I have tried a number of work arounds such as this function but it to fails to recognize that it is on the editor screen.
function is_admin_request() {
$current_url = home_url( add_query_arg( null, null ) );
$admin_url = strtolower( admin_url() );
if ( strpos( $current_url, $admin_url ) ) {
return 1;
}
if(wp_doing_ajax()) return 1;
return 0;
}
if(wp_doing_ajax()) return 1;
return 0;
}
To Reproduce
Steps to reproduce the behavior:
call is_admin from server while saving a post.
Expected behavior
is_admin should return true on the editor screen
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
4.1.1
The text was updated successfully, but these errors were encountered: