Merge pull request #13931 from woocommerce/fix/register-admin-settings

If The $object is not really an object, don't continue. It's invalid.
This commit is contained in:
Claudiu Lodromanean 2017-04-05 09:24:37 -07:00 committed by GitHub
commit e1b9165439
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' ) );