• Home
  • PHP
  • MySQL
  • Laravel
  • Demos
  • HTML
  • jQuery
  • Framework
  • Request Tutorial
PHP Lift
  • Home
  • Demos
  • Advertisement
PHP Lift
  • Home
  • PHP
  • MySQL
  • Laravel
  • Demos
  • HTML
  • jQuery
  • Framework
  • Request Tutorial
  • Follow
    • Facebook
    • Twitter
    • Google+
    • Pinterest
    • Youtube
    • Instagram
    • RSS
How to Create a Custom Options Page in WordPress?
Home
WordPress

How to Create a Custom Options Page in WordPress?

February 4th, 2026 Huzoor Bux PHP, WordPress 0 comments

Facebook Twitter Google+ LinkedIn Pinterest

The options page lets us create an additional admin page to WordPress that allows you to build custom fields such as an input box, choose choices, color picker media uploader, etc., and manage these fields.

You can modify the admin options pages within The WordPress Dashboard area. You can also make sub-admin options pages beneath. All information is stored in the table wp_options and they are accessible globally.

To make a custom settings page within WordPress You must know about WordPress actions/hooks as well as the settings API and know how to utilize these APIs.

Create Options Page in Settings Menu

Utilize to use the add_options_page() function to create a new submenu within Settings’ Settings primary menu.

add_action( 'admin_menu', 'custom_options_page' );function custom_options_page() {add_options_page(

'Homepage Settings', // page title

'Homepage Settings', // menu title

'manage_options', // capability to access the page

'custom-page-slug', // menu slug

'my_custom_page_content', // callback function

5 // position

);}function my_custom_page_content() {echo "This is a custom options page.";}

Read Also: How to building responsive WordPress theme using Bootstrap

Create Form and Define Settings API

Now you have to make a form in the ‘my_custom_page_content‘ function that we have a callback in the previous step.

function my_custom_page_content() {

?>

   <div class="wrap">

      <h1>Homepage Settings</h1>

      <form method="post" action="options.php">

         <?php

            settings_fields( 'custom_page_settings' ); // settings group name

            do_settings_sections( 'custom-page-slug' ); // a page slug

            submit_button();

         ?>

      </form>

   </div>

<?php

}

Create Fields and Register Settings

We will now add a few fields to the form making use of the Settings API and registering that setting.

To include the fields on the customized options pages we’ll use to use the field add_settings_field() function.

add_settings_field(

   'homepage_banner_text',

   'Homepage Banner Text',

   'homepage_banner_text_field_html', // function which prints the field

   'custom-page-slug', // page slug

   'homepage_section', // section ID

   array(

      'label_for' => 'homepage_banner_text',

      'class' => 'banner-text',

   )

);

Callback function

function homepage_banner_text_field_html() {

   $banner_text = get_option( 'homepage_banner_text' );

   echo '<input type="text" id="homepage_banner_text" name="homepage_banner_text" value="'.$banner_text.'" />';

}

Then register the all fields using the register_setting() function.

register_setting(

   'custom_page_settings', // settings group name

   'homepage_banner_text', // field name

   'sanitize_text_field' // sanitization function

);

That’s it!!!

  • Tags
  • How to
  • Options Page
  • WordPress
Facebook Twitter Google+ LinkedIn Pinterest
Next article How to show Image before upload JavaScript & HTML5 FileReader()
Previous article The Art of Debugging in Software Development: A Comprehensive Guide

Huzoor Bux

I am a PHP Developer

Related Posts

Guardian Gaze A Powerful WordPress Security Plugin with Advanced Features Guide
February 20th, 2026

Guardian Gaze A Powerful WordPress Security Plugin with Advanced Features

Laboratory Management System (LIMS) in PHP MySQL – A Complete Guide MySQL
February 18th, 2026

Laboratory Management System (LIMS) in PHP MySQL – A Complete Guide

Stripe Payment Gateway Charge Credit Card with PHP Example API
February 4th, 2026

Stripe Payment Gateway Charge Credit Card with PHP Example

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe
Get new posts by email:
Powered by follow.it
Advertisement
Like us
Recent Posts
  • Guardian Gaze A Powerful WordPress Security Plugin with Advanced Features
  • Laboratory Management System (LIMS) in PHP MySQL – A Complete Guide
  • Introduction to Git for version control
  • Const vs. Let vs. Var in Javascript. Which one should you use?
  • How do I send an auto-reply message on Skype?
Categories
  • API
  • Bootstrap
  • Bot
  • CSS
  • CSS 3
  • Database
  • Designing
  • Framework
  • Guide
  • HTML
  • HTML 5
  • JavaScript
  • jQuery
  • Laravel
  • MySQL
  • Node.js
  • oAuth
  • Payment
  • PHP
  • Python
  • Social
  • Tips
  • Web 3.0
  • WordPress
Weekly Tags
  • PHP
  • How to
  • javascript
  • laravel
  • Web Development
  • jQuery
  • MYSQL
  • HTML to PDF
  • PHP framework
  • css
  • About
  • Privacy Policy
  • Back to top
© PHPLift.net. All rights reserved.