I am creating plugin on base of boiler plate structure and i am trying to create admin menu page, but i am getting an error.
Below is my code.

below code in class-plugin-name.php inside admin hook,

$this->loader->add_action( 'admin_menu', $plugin_admin, 'define_admin_page' );
$this->loader->add_action( 'admin_init', $plugin_admin, 'define_setting_fields' );

inside class-plugin-name-admin.php ,

public function define_admin_page(){

          __('SEO Boost', 'seo-boost'), 
          __('SEO Boost', 'seo-boost'), 
          array(&$this, 'seo_boost_page_callback')

    public function seo_boost_page_callback(){
        include_once 'partials/plugin-name-admin-display.php';

    public function define_setting_fields(){
               __( 'General', 'seo-boost' ), 
               array( $this, $this->option_name . '_general_line' ), 

           $this->option_name . '_text', 
           __("Text box label:", 'seo-boost'), 
           array( $this, $this->option_name . '_text_api_element' ),    
          array( 'label_for' => $this->option_name . '_text' )

    register_setting($this->option_name.'general-section', $this->option_name . '_text');           


    public function seo_boost_general_line(){
        echo '<p>' . __( 'Please change the settings accordingly.', 'outdated-notice' ) . '</p>';

    public function seo_boost_text_api_element(){
        $text = get_option( $this->option_name . '_text' );
        echo '<input type="text" name="' . $this->option_name . '_text' . '" id="' . $this->option_name . '_text' . '" value="' . $text . '"> ' . __( 'text', 'seo-boost' );

inside plugin-name-admin-display.php there is code for display admin page form fields,

<div class="wrap">
            <h1><?php _e('Seo Settings', 'seo-boost'); ?></h1>
             <form action="options.php" method="post">
        submit_button(); ?>             

But i am getting an error of Fatal error:

Call to undefined function settings_fields() in plugin-name-admin-display.php on line 20

Read more here: Call to undefined function settings_fields() in boiler plate plugin structure


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: