0
votes
1answer
387 views

update_post_meta() whenever custom post type is updated

I need the following functionality. Whenever my custom post type is updated or saved I need to overwrite certain custom post metas. I need to make sure this only affects posts of the post type ...
0
votes
1answer
97 views

How to validate select field in post meta?

I want to display a select dropdown field in the post meta. How can I validate the input before saving it? Currently, I am simply saving without validating like this: if ( isset( ...
2
votes
1answer
154 views

unable to save post meta on single field with multiple selects

I set up two select boxes in one meta field by putting two arrays inside the 'options' array of my callback. The HTML is outputting fine, but the meta is not being saved to the database... Here is a ...
0
votes
1answer
81 views

displaying an error before update_post_meta

I'm trying to restrict how many items you can associate with a post so in my save function I have: add_action( 'save_post', array( $this, 'save_custom_items_data' ), 10, 2 ); public function ...
1
vote
1answer
209 views

Better post meta efficiency?

I work with websites which require using Post Meta for Post Objects within a particular Post Type. I often add a Meta Box to a particular Post Type, to provide additional settings for the new Post ...
0
votes
1answer
93 views

Saving zero as meta value

I have a meta_key called "_ordre" and each time I create a new custom post, a new meta_value is set for that meta_key. The thing is, when I set the value of '_ordre' to 0, the meta_value is not saved ...
0
votes
2answers
496 views

Save post meta foreach loop

My brain has fallen over. How do I save this post data? Building some key-value pairs in the form. for ($i = 1; $i <= 3; $i++) { $saved = $meta[$i]; //print_r($saved); ...
0
votes
1answer
528 views

Auto save title as custom meta field value

I create a custom post type where I removed the "Title", instead I want to use one of my custom meta value to become the title. This is just to make sure the title look good. Know that the post ...
0
votes
3answers
1k views

troubles with get_post_meta (and saving it)

im having trouble using "add post meta" and "get post meta" : i have a new meta box in my taxonomy : i always have the value "empty meta" inside the input field, even after i enter anything : like ...
8
votes
3answers
4k views

Passing error/warning messages from a meta box to “admin_notices”

I have a simple meta box that updates the post custom fields (using update_post_meta()). How can I send a error or warning message to the next page after the user publishes/updates the post and ...
1
vote
1answer
372 views

Trigger “unsaved changes” dialog for custom post meta changes

I'm using a custom post type with custom meta fields, but autosave and the "unsaved changes" dialog don't seem to be triggered for these custom meta fields. Autosave isn't as important to me as the ...