I’ve created a custom post type menu with register_post_type
. I want to add a settings sub-menu with lots of options, including extra “Add option to a select list” button.
The problem: when using settings api, any <form>
wants action="options.php"
. But that ends with a redirect to the edit.php address required when the sub menu is added to the custom post type menu. That means $_POST
is lost by the time the code get back to the options page – so there is no way to see if those extra buttons were pressed.
Not using options.php for the <form> directs the submits directly to edit.php, where it dies with a permissions option. I’d prefer not to use JavaScript to fill in those dynamic settings. Any way to bypass the settings API and options.php
, and get directly the edit.php but not get the permissions crash?
I looked at the source code, as well as tons of plugins with custom post type and a settings page, but they ALL use settings API via options.php
– and that precludes getting an alternate submit button click back to the settings code. In this case, this is a severe limitation with the Settings API because the redirect at the end loses $_POST
.
For less of problems, you can use Advanced Custom Fields plugin for create a good options page , and custom fields into posts, pages, and so on.
Plase check it here:
http://www.advancedcustomfields.com/add-ons/options-page/ – Paid addon.
Plase see a video.