Unlock the Secret to Effortless Website Magic: Build Your First WordPress Plugin Today!
Step 2: Add the settings page
Add a new page under Settings in the WordPress admin:
function qrt_register_settings_page() {
add_options_page(
'Quick Reading Time',
'Quick Reading Time',
'manage_options',
'qrt-settings',
'qrt_render_settings_page'
);
}
add_action( 'admin_menu', 'qrt_register_settings_page' );
This code adds a settings page for your plugin under the WordPress admin “Settings” menu. It uses add_options_page()
to register the page, and hooks the function to admin_menu
so it appears in the dashboard. The callback (qrt_render_settings_page
) will output the page’s content.