iconicwp / WordPress-Settings-Framework

A settings framework for the WordPress settings API
MIT License
334 stars 66 forks source link

Weird errors when trying to instantiate class inside a plugin #84

Closed danilomedeirosmusica closed 2 years ago

danilomedeirosmusica commented 2 years ago

I'm getting two errors when trying to instantiate the wpsf class from inside a plugin:

Notice: Undefined index: slug in /var/www/html/wp-content/plugins/apoiase/classes/wp-settings-framework/wp-settings-framework.php on line 201

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/apoiase/classes/wp-settings-framework/wp-settings-framework.php:201

Any ideas? Note that I'm instantiating it inside a "classes" folder.

davegreenwp commented 2 years ago

hi @danilomedeirosmusica are you able to provide access to the code you're using, or share it here? If you are passing an option group slug in as the second parameter which initialising WordPressSettingsFramework, the construct_settings() method in the framework should be setting the settings page slug value automatically.

The second warning relating to header information suggests that content has already been sent to the browser, meaning that no additional headers can be sent. I would check your plugin codebase to see if anything is generating output before the settings framework class is initialised.

davegreenwp commented 2 years ago

hi @danilomedeirosmusica just checking in to see if this is still an issue? If not, we can close this off. Thanks!

danilomedeirosmusica commented 2 years ago

Please do. I ended up doing the code manually, will come back to this as soon as possible.

Em seg., 12 de set. de 2022 14:45, Dave Green @.***> escreveu:

hi @danilomedeirosmusica https://github.com/danilomedeirosmusica just checking in to see if this is still an issue? If not, we can close this off. Thanks!

— Reply to this email directly, view it on GitHub https://github.com/iconicwp/WordPress-Settings-Framework/issues/84#issuecomment-1244086402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZCJUPOPJQ74KVCWIEGEZ6DV55TZ3ANCNFSM55CAVEBQ . You are receiving this because you were mentioned.Message ID: @.***>