A correct hook for saving meta boxes data
A correct hook for saving meta boxes data
A correct hook for saving meta boxes data
I found the answer now it was the way i was trying to save it this is what I done in the save function if( isset( $_POST[ ‘ck_sale_item’ ] ) ) { update_post_meta( $post_id, ‘ck_sale_item’, ‘on’ ); } else { update_post_meta( $post_id, ‘ck_sale_item’, ‘off’ ); }
disabled fields can’t be submited, that is as is. Change disabled to readonly and it will submit.
By default WordPress doesn’t load admin classes/function definitions in the front end of the site. You need to explicitly require the files. As far as I remember requiring wp-admin/includes/admin.php would get you most of typical stuff.
Found it out! I needed to put the registered taxonomy to the same post type in the registered_taxonomy() function.
This is a PHP syntax issue, you can’t put a ternary operator inside an echo. Assign the value to $meta in one line: $meta=”” == get_post_meta($post->ID, ‘twitter_embed’, true) ? get_option(‘my_option_name’) : get_post_meta($post->ID, ‘twitter_embed’, true);
If looks like you are using CMB (Custom-Metaboxes-and-Fields-for-WordPress) to create your create metaboxes. CMB is already supplying a option to group and repeat meta box that you can use. You can check this link As far as your code it is concern if suppose it should go like this: function dikka_cmb_meoxes( array $meta_boxes ) { … Read more
Verify that the “GD” php library is enabled. You can do so by adding phpinfo(); to one of your php templates and then search the result for GD or GD Support. The GD library is used for image manipulation and resizing is one of those functions. To enable GD on windows you can edit the … Read more
You can not put condition in callback function as it will display the meta box without the HTML. Better you can wrap add_meta_box() in if condition. If you are on post edit screen you can get the post id in this way. $post_id = false; if (!empty($_POST[‘post_ID’])) { $post_id = $_POST[‘post_ID’]; } else if (!empty($_GET[‘post’])) … Read more
You method iam_user_can_save is incorrectly used as you are returning nothing to check in that method. Try this (not sure what behaviour you really want, the following code is just a working example from your code): public function iam_user_can_save( $post_id, $nonce ){ // Checks save status $is_autosave = wp_is_post_autosave( $post_id ); $is_revision = wp_is_post_revision( $post_id … Read more