If The $object is not really an object, don't continue. It's invalid.

This commit is contained in:
Mike Jolley 2017-04-05 11:10:27 +01:00
parent 4aaabb07b7
commit 5770fb132e
1 changed files with 5 additions and 0 deletions

View File

@ -24,7 +24,12 @@ class WC_Register_WP_Admin_Settings {
* @param string $type Type of settings to register (email or page).
*/
public function __construct( $object, $type ) {
if ( ! is_object( $object ) ) {
return;
}
$this->object = $object;
if ( 'page' === $type ) {
add_filter( 'woocommerce_settings_groups', array( $this, 'register_page_group' ) );
add_filter( 'woocommerce_settings-' . $this->object->get_id(), array( $this, 'register_page_settings' ) );