When you do that include
, you are trying to add the save_post
hook inside the add_meta_boxes_$post_type
hook. It should be independent.
add_action( 'add_meta_boxes_page','load_home_meta' );
add_action( 'save_post', 'save_home_meta' );
// Declare all callback functions
Also, you shouldn’t declare a function inside a function. Maybe you should consider creating a plugin for handling this, see: Where to put my code: plugin or functions.php?.
Or, if you really want it inside your theme’s functions.php
, do a include
for all this meta box code.
You’ll find plenty of working examples here, check this search query:
+save_post +add_meta_box is:answer
Related Posts:
- Specific coditional usage [closed]
- Custom metabox not working
- Get fields from metabox array
- Custom field/meta populated by dropdown of existing posts?
- What is the index [0] for on post meta fields?
- Individual Widgets per Page
- Gutenberg add a custom metabox to default blocks
- ‘Preview Changes’ for custom meta boxes?
- Using TinyMce with textareas in meta boxes on custom post types
- add meta box – custom field : which to choose?
- Add metabox to document tab in gutenberg
- How to add add_meta_box to specific Page Template?
- Custom field metabox not showing in back-end
- How to hide meta box values from custom fields list?
- Adding another state (spam, reject, approve) to wordpress comments?
- echo value from ‘select’ field type into page template using cmb2?
- WP doesn’t show Array Custom Fields?
- Arrange custom fields with drag and drop?
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- Unable to get Preview of Uploaded image within a Custom Meta box
- Using media-upload.php to upload mp3 via custom fields
- extend Meta Box / Document Panel
- Add new “Insert Into Post” button with another function
- Add custom option to Standard Page Attributes Meta Box
- How to store the value of a custom field dropdown select for post referencing?
- Add multiple images to a page sidebar
- Only show metabox when date-value in other metabox is over?
- Add meta data to the menu
- Detect meta value changes when post is updated (post_updated)
- Custom Meta Boxes: Store two values in one repeatable field
- can you set a default value to a custom field
- Populating meta box with select-list of existing posts, and assigning it to custom post types
- Create meta boxes that don’t show in custom fields
- How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?
- Guest Author – How can I use custom fields to create guest author link?
- post meta data clearing on autosave
- How to load php file for specific page in admin?
- How to set default metaboxes on user creation?
- Saving multiple Metabox contents
- Metabox nonce PHP notice
- TinyMCE in Custom Metabox not loaded after upgrading from WP 3.1.4 to WP 3.2
- wp_editor in add_meta_boxes does not show gallery
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- Problem in custom meta boxes
- Multiplile values checkbox or select in custom meta box
- Create custom field key upon theme activation
- Problem with adding exta field in metabox in custom post type
- Add input field to ‘Pages > Edit Page’ through functions.php
- Adding a custom field or metabox to the post-thumbnail widget?
- Auto-add paragraphs to custom field?
- Add description text under input field for new profile fields
- Custom fields to save multiple values
- How to add a predefined custom field without using a plugin?
- How do I add custom_meta_box_id’s value?
- Undefined index error when saving content on metabox
- How to save multiple metaboxes?
- Metabox with multiple fields added by user and upload box
- add meta box using function.php
- Metabox image upload and custom field
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- My metabox class
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- How to construct multiple meta boxes
- Populate Custom Field Dropdown on Theme Install?
- Loading scripts to the Post Edit page only
- Force hide custom field metaboxes
- Woocommerce with metabox plugin
- How to add content at the end of posts?
- wp_editor removes paragraph from custom meta box
- How to Display Custom Meta Box only on Specific Page IDs
- WP Custom Fields Metabox Disappears – ACF plugin issue [closed]
- Metabox will not save
- How to check for specific meta box value on front end and output accordingly
- Where did the Add New Custom Field go?
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- Admin meta Image Path
- Tweak Meta for Post to work it for Pages also
- Odd PHP Code To Display HTML Of Meta Box [closed]
- custom field not saved
- How to create a Custom Meta Box with Name/Value Admin User Input Fields?
- Create Multiple File Upload Metabox in WordPress
- Users Select inside custom metabox
- how to put a custom field value in variable
- Auto Populate Custom Field with Complex Value That Increase by One?
- Better Method for Multiple Meta Boxes
- Getting the ID of any image for use in functions.php
- how to fetch the meta field keys/meta boxes from a post type?
- How to Create Dynamic Fields in a Meta Box?
- Set front page option using custom fields?
- Auto-remove custom field with no value on publish
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- Can’t get metabox value (a url) returned using WPAlchemy
- Display custom field values from posts on frontpage
- Unsaved changes in metabox inputs not detected in the block editor
- How do I update a field of a meta box?
- Custom Meta Box (SELECT) Not Saving
- Get updated meta value after post update or published (custom post type) using hook
- Custom Attachment Caption Fields
- Button inside Custom Meta Box triggering the Update Button
- Why is my Custom Meta Box Field Inputs NOT saving?