You seem to be creating a recursive loop.
In stm_addmenu_auto_delete_event()
, you register an admin page via add_menu_page()
that has a callback of auto_delete_settings_callback
:
function stm_addmenu_auto_delete_event() {
add_menu_page(
'Automatic deletion',
'Automatic <br/> deletion',
'manage_options',
'manage-auto-delete-page',
'auto_delete_settings_callback',
In new_settings_auto_delete
you register a settings field with a callback of auto_delete_settings_callback
:
function new_settings_auto_delete() {
// …
add_settings_field(
'default_auto_delete_field',
'By default activate automatic deletion',
'auto_delete_settings_callback',
'manage-auto-delete-page',
Thus, when you navigate to the Automatic deletion page you registered in stm_addmenu_auto_delete_event()
:
auto_delete_settings_callback()
is called.- In
auto_delete_settings_callback()
,do_settings_sections('manage-auto-delete-page');
is executed. - WordPress finds settings fields registered to
'manage-auto-delete-page'
. default_auto_delete_field
is found, with a registered callback ofauto_delete_settings_callback
.- We loop back to step 1 recursively, until the server runs out of memory.
It seems you may have meant to register a different callback for either the add_menu_page()
call or the add_settings_field()
call.