WordPress.org

Ready to get started?Download WordPress

Forums

Plugin is throwing blank pages on plugin option admin and options.php (9 posts)

  1. freebee1989
    Member
    Posted 4 years ago #

    So, I'm using a brand new install of the latest WordPress, no other plugins, just a development test.

    What are the most common reasons of pages being sent to a blank options.php after saving changes? The data is saved, I can see it afterwards, and it saves to the tables... So I have no idea what's up. Other than that, there's no other errors being thrown out.

  2. freebee1989
    Member
    Posted 4 years ago #

    Another note. I've tried the sample plugin option pages form they give you in the codex, and it's still the same blank page.

    http://codex.wordpress.org/Creating_Options_Pages

  3. freebee1989
    Member
    Posted 4 years ago #

    This one to be exact:

    <?php
    // create custom plugin settings menu
    add_action('admin_menu', 'baw_create_menu');
    
    function baw_create_menu() {
    
    	//create new top-level menu
    	add_menu_page('BAW Plugin Settings', 'BAW Settings', 'administrator', __FILE__, 'baw_settings_page',plugins_url('/images/icon.png', __FILE__));
    
    	//call register settings function
    	add_action( 'admin_init', 'register_mysettings' );
    }
    
    function register_mysettings() {
    	//register our settings
    	register_setting( 'baw-settings-group', 'new_option_name' );
    	register_setting( 'baw-settings-group', 'some_other_option' );
    	register_setting( 'baw-settings-group', 'option_etc' );
    }
    
    function baw_settings_page() {
    ?>
    <div class="wrap">
    <h2>Your Plugin Name</h2>
    
    <form method="post" action="options.php">
        <?php settings_fields( 'baw-settings-group' ); ?>
        <table class="form-table">
            <tr valign="top">
            <th scope="row">New Option Name</th>
            <td><input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" /></td>
            </tr>
    
            <tr valign="top">
            <th scope="row">Some Other Option</th>
            <td><input type="text" name="some_other_option" value="<?php echo get_option('some_other_option'); ?>" /></td>
            </tr>
    
            <tr valign="top">
            <th scope="row">Options, Etc.</th>
            <td><input type="text" name="option_etc" value="<?php echo get_option('option_etc'); ?>" /></td>
            </tr>
        </table>
    
        <p class="submit">
        <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
        </p>
    
    </form>
    </div>
    <?php } ?>
  4. freebee1989
    Member
    Posted 4 years ago #

  5. freebee1989
    Member
    Posted 4 years ago #

    Again, it's still saving, just throwing a blank page afterwards. So I'm thinking, whatever's missing in the example, just needs to be added to my plugin page aswell.

  6. freebee1989
    Member
    Posted 4 years ago #

    Anyone know?

  7. abonne
    Member
    Posted 4 years ago #

    I am having the same problem with my plug-in. It works as I expect but it throws a blank page.

    Just like you, I followed the example of the codex page.

    I am running v2.9.2.

  8. Steve
    Member
    Posted 4 years ago #

    Did you ever solve this?

  9. davidsword
    Member
    Posted 3 years ago #

    it's because there's whitespace at the end of the document.

    I had 3 extra lines at the bottom of my functions.php after the last ?> & I was getting the blank page stuck on options.php...

Topic Closed

This topic has been closed to new replies.

About this Topic