The problem was a redirect in site-info.php. After that the $_POST variable was empty in the code inserting in the admin_footer.
I just need to use a further hook ‘admin_init’ and save the value here.
add_action('admin_init', 'pg_save_custom_site_options');
function pg_save_custom_site_options(){
global $pagenow;
if( 'site-info.php' == $pagenow &&
isset($_REQUEST['action']) &&
'update-site' == $_REQUEST['action']
) {
// Use a default value here if the field was not submitted.
$new_field_value="0";
if ( isset( $_POST['blog']['blog_order'] ) ) {
$new_field_value = intval( $_POST['blog']['blog_order'] );
// save option into the database
if( is_int($new_field_value) ){
update_blog_option( $_POST['id'], 'blog_order', $new_field_value );
}
}
}
}
Related Posts:
- Get Data From wp_sitemeta for Multisite network
- Is it safe to store a user setting you don’t want the user to ever modify as a user option?
- What is the advantage of the wp_options design pattern?
- Custom field when adding new site to multisite networked WordPress
- Making a configurable field translatable
- get_post_meta fields don’t show up on posts page
- ACF won’t load from a custom JSON location
- Set front page option using custom fields?
- Pass current post title to a predefined link
- display custom field from inner blog in the main homepage of wordpress multisite
- Redirect to another page using contact form 7? [closed]
- meta fields for the whole wordpress site
- Where does this field get its value?
- Warn user that data may be lost for custom pages
- Adding “meta” info to WP site PHP function?
- Custom Theme Fields in Settings Menu – apply filters to one of those fields?
- Show echo ready in single.php
- Automatically Add Tags Taxonomy in Post from Custom field’s value
- Automatically Add Custom Fields Value as Tags
- wp option get blogname –url=my-sub-site.com returning main site option
- How to get data from user meta custom fields created with acf-pro plugin?
- how to turn a link field into a button or link text
- Gutenberg add a custom metabox to default blocks
- How to display custom fields in hestia theme
- How to update only certain custom fields in a the cache of a page?
- Woocommerce products search with custom fields
- Custom meta fields and meta keys
- Making custom meta box required (with error message if not filled in) on Gutenberg
- HTML for adding a meta box (basic text field) to page editor?
- Convert author metadata to a custom field
- Adding Custom Metadata to my Archive/Posts page
- Is the use of many custom field not good for server?
- Move the post title to another field
- How to save multiple values with same meta_key, each value linked to another tag id
- Move the metaboxes to the very top of post editor
- Shortcode for Custom Field of Media Attachment (to use with Featured Images)
- ACF multi taxonomy on filterable gallery
- Arrays in custom fields or is there a better way?
- How to improve my non-unique metadata MySQL entries?
- Use value from ACF to populate other fields
- Dynamically populate query source in Elementor post widget
- Custom date column in user table not sorting correcting
- Set class if a meta value is set within post archive
- Add link to wordpress field data
- Adding text box with add_meta_box
- pass custom value from single.php to another file via get
- Changing form action based on selected value
- Custom User Dashboard
- Add forms dynamically in admin pages?
- Custom field in media library not saving, selected() function not adding “selected” to select list input type
- WordPress Rest API custom field not updating till i manually update the post
- Is there any way to make a custom field for a post only if the author is a certain user?
- Setting user permissions per post
- How to add a post’s view count into the WordPress API response
- Let any visitors delete a post if they know Id nr & password?
- How to speed up post list slowed by update_meta_cache()?
- Custom Fields displaying in single line
- How to use ACF with javascript to update custom field values?
- variable not passed correctly to database using custom field
- WordPress Blocks, setAttributes not saving
- Save Taxonomy of Post via custom Taxonomy Select Dropdown
- Using Customizer API vs Custom Meta Box for custom content
- non-unique #_ajax_nonce id in browser console
- Change permalink structure in all sites of a multisite
- Custom pages or Custom Posts
- get_avatar filter is not working as per requirement
- Ordering by ACF custom field vaule
- What WordPress “technology” would I use if I wanted subscribers to be able to mark pages with characteristics and notes?
- Sort by an ACF field in a tax_query
- How can I ‘check’ the “custom fields” box from the Screen Options?
- search based on custom field
- Why isn’t update_post_meta saving?
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- WP meta_query args not working in function
- Is it possible to add Term Meta Fields to a WooCommerce Attribute?
- How do i call up default post title in custom posts
- Filtering posts by ACF meta query
- trying to add extra field using hooks
- Can’t set custom meta fields for a post
- Saving Custom Field that includes Quotation marks
- WordPress Admin – Automatically Sort Custom Posts by Custom Field Date Value in d-m-Y Fomat
- Very large list of options for BuddyPress profile fields
- How do I display an article using a WordPress custom field?
- how can i show WordPress custom field data to my short code?
- Custom Fields not working properly
- Delete a custom field in mysql for all posts with specific category id
- Custom user registration fields in user_register hook
- Weird custom fields data lost
- Unable to change checkout placeholder text
- Store comment form custom field in custom database
- update a custom field with the value of another existing custom field
- How to I change the value of a custom field on the home page?
- Line break description wordpress
- Allow HTML in Custom Metabox area
- Custom Fields Not Showing (ACF not installed)
- Custom Field URL + description
- Why does my numeric meta query work only on one meta key and not the other?
- Show Custom field value instead of title in WP Menu
- How to save multiple custom user profile fields using repeater JQuery
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title