Skip to content

Commit

Permalink
Fix PHP Notice "Trying to get property 'base' of non-object"
Browse files Browse the repository at this point in the history
Closes earnjam#7
  • Loading branch information
marcissimus committed Feb 2, 2021
1 parent c80ad04 commit 031b34d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions site-health-tool-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Site Health Tool Manager
* Plugin URI: https://github.com/earnjam/site-health-tool-manager
* Description: Control which tests appear in the the Site Health Tool
* Version: 1.2
* Version: 1.3
* Author: William Earnhardt
* Author URI: https://wearnhardt.com
* License: GPL2
Expand Down Expand Up @@ -34,7 +34,8 @@ function shtm_add_settings_page() {
*/
function shtm_filter_tests( $tests ) {
// Don't filter on the plugin settings page
if ( get_current_screen()->base !== 'settings_page_shtm-settings' ) {
$scr = get_current_screen();
if ( property_exists($scr, 'base') !== true || $scr->base !== 'settings_page_shtm-settings' ) {
$hidden_tests = (array) maybe_unserialize( get_option( 'shtm_hidden_tests' ) );
foreach ( $hidden_tests as $test ) {
unset( $tests['direct'][ $test ] );
Expand Down

0 comments on commit 031b34d

Please sign in to comment.