Settings API not saving values to database
Settings API not saving values to database
Settings API not saving values to database
I was developing locally with Local, so I tested in the online version, where it worked. I then deactivated most of the plug-ins locally, and it started to work. I might have also stopped the site and run it again, I am not sure, but it might have helped? Anyway, after reactivating all the same … Read more
How to get specific setting by settings_fields()?
If you’ve already got a solution that works using FeedPress you might as well stay with that, there isn’t a particularly clean way of aggregating multisite posts into a single blog. One alternative is to use the Sitewide Tags plugin, but given what you want to do, you should probably stay with what’s working.
No, you need to add a call to settings_errors /** * Displays all messages registered to ‘your-settings-error-slug’ */ function your_admin_notices_action() { settings_errors( ‘your-settings-error-slug’ ); } add_action( ‘admin_notices’, ‘your_admin_notices_action’ ); Else the errors you added will not be displayed. You may also want to check that error_found is true. It is not a wordpress constant I … Read more
Use the Settings API. A look at my latest plugin may help you to understand how to register a save function for your fields. Most relevant excerpt: /** * Register custom settings for the fields. * * @see save_settings() * @see print_input_field() * @return void */ public function add_contact_fields() { register_setting( ‘general’, $this->option_name, array ( … Read more
Based on what you want, if it were me, I would enable featured images and excerpts on pages and then build a widget to feature a page. Then put a sidebar on your homepage and use those widgets to reorder and select which pages to show in which order. Then you’re managing all content related … Read more
Your sanitize_callback function should not return false or null indicating that input is not valid – its intent is to always return a valid value. The value returned by this function is what will be save to the database, so in order for it to actually sanitize anything it will have to return something that … Read more
I figured it out. I needed to have a single value for $option_group across all register_settings and settings_fields. It’s working now.
Try it like this: if (isset($_REQUEST[‘tab’]) && $_REQUEST[‘tab’]) { typesetter_save_settings(); } register_sections(); $current = isset($_REQUEST[‘tab’]) ? $_REQUEST[‘tab’] : ‘page’; You have to check for a certain field of $_REQUEST (or $_POST etc.) before accessing it—or you get warnings.