I followed the Settings API page and used the example to get the following code: http://pastebin.com/CUA7nLCR

When I change $settingsPage to general, reading, writing, etc. this all works flawlessly but when I change it to permalink it does show up, but it will not store the value. Does anyone know why?

1 Answer 1


I ran into this very same issue and I have a workaround. Hopefully it will be fixed in the upcoming 3.3 release as this trac ticket suggests.

The workaround basically replicates the important bits of the wp-admin/options.php file where settings registered via the settings API are processed.

The reason additional permalink settings do not currently update is because the options-permalink.php page posts back to itself rather than to options.php so no handling of your registered settings occurs.

The following code placed in your theme or plugin will get things working:

// add a very low priority action to make sure any extra settings have been added to the global
add_action( 'admin_init', 'enable_permalink_settings', 999999 );
function enable_permalink_settings() {
    global $new_whitelist_options;

    // save hook for permalinks page
    if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) {

        $option_page = 'permalink';

        $capability = 'manage_options';
        $capability = apply_filters( "option_page_capability_{$option_page}", $capability );

        if ( !current_user_can( $capability ) )
            wp_die(__('Cheatin’ uh?'));

        // get extra permalink options
        $options = $new_whitelist_options[ $option_page ];

        if ( $options ) {
            foreach ( $options as $option ) {
                $option = trim($option);
                $value = null;
                if ( isset($_POST[$option]) )
                    $value = $_POST[$option];
                if ( !is_array($value) )
                    $value = trim($value);
                $value = stripslashes_deep($value);
                update_option($option, $value);

         *  Handle settings errors
        set_transient('settings_errors', get_settings_errors(), 30);
  • Probably not in 3.3. Settings reorg got punted to 3.4.
    – Otto
    Sep 27, 2011 at 19:11
  • @otto Ah ok. Guess I'll be keeping this snippet around for a while longer then! Sep 28, 2011 at 9:06
  • Keeping this around indefinitely! That ticket is still open in 2015! Sep 4, 2015 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.