Meta box checkbox won’t save

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’ ); }

Using Meta Boxes in a Custom Page Template

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.

Custom meta box repeated field

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

Custom meta box using OOP way doesn’t save data

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