[wp-trac] Re: [WordPress Trac] #9296: Settings API & Permalink
Settings Page Bug
WordPress Trac
wp-trac at lists.automattic.com
Mon Mar 9 18:01:09 GMT 2009
#9296: Settings API & Permalink Settings Page Bug
--------------------------+-------------------------------------------------
Reporter: jfarthing84 | Owner: jfarthing84
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Unassigned
Component: General | Version: 2.7.1
Severity: major | Resolution: fixed
Keywords: has-patch |
--------------------------+-------------------------------------------------
Changes (by jfarthing84):
* keywords: register_setting, settings api, permalink settings => has-
patch
* status: assigned => closed
* resolution: => fixed
Comment:
In order to make the options-permalink.php page capable of saving custom
options hooked in using the add_settings_field() and register_setting()
functions, I modified three files. The plan was to make options-
permalink.php submit to post.php, like all of the other options pages,
instead of submitting to itself and handling it's own post.
I had to modify options-permalink.php by changing the form HTML to post to
options.php and also added the settings_fields('permalink') in place of
the wp_nonce_field('update_permalink'). I changed the line for the update
message handling from $_POST['submit'] to $_GET['updated'] since we will
no longer be posting to this page, but the updated value will be passed
back upon success. Finally, I removed the whole form processing code to
insert into options.php.
With options.php, I added the form processing code from options-
permalink.php right before the custom options get saved. I used an if
clause to obviously only save those options when options-permalink.php is
submitted.
I then found with the modifications made to those two files that upon
successfully updating the permalinks, I would receive two different
success messages. One was coming from options-permalink.php's own success
messages, plus one from options-head.php. So, I modified options-head.php
to not display any messages if it is on the options-permalink.php page and
allow options-permalink.php to use it's own notifications.
In the end, all is working and you can now save custom settings from the
permalinks settings page.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9296#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list