custom metabox nonce verification fails

Ok, I found the answer. It’s a quite stupid copy/paste mistake. The name of my nonce_field was not unique. I had already created another nonce from the same plugin but another file. Therefore the basename(__FILE__) value was different leading to a different nonce. All I had to do was change the the name of the … Read more

jQuery UI Sortable not Working With Metabox

So, after an annoyingly long struggle, I discovered that I needed to have the script enqueued/registered with no dependencies. So in the end, to make it work, I needed this: function add_admin_scripts( $hook ) { global $post; wp_register_script( ‘sectioned_page_script’, get_stylesheet_directory_uri() . ‘/js/sectioned_page.js’ ); if ( $hook == ‘post-new.php’ || $hook == ‘post.php’ ) { if … Read more

Meta Box – Javascript Datatable

Refer to Creating a new PostBox in WordPress. As long as you name the fields the same in render as you do in save then you’re good. RENDER echo ‘<input type=”text” id=”boxpost_meta_field” name=”boxpost_meta_field”‘; SAVE $mydata = sanitize_text_field( $_POST[‘boxpost_meta_field’] ); // Update the meta field. update_post_meta( $post_id, ‘_boxpost_meta_field_value_key’, $mydata ); GET $value = get_post_meta( $post->ID, ‘_boxpost_meta_field_value_key’, … Read more

Resposive admin classes?

I don’t think so, it only have responsiveness to the lateral menu. You will have to create your own HTML and CSS responsive structure.

Is this Edit Post Screen?

I believe you want something like this: EDITED: function function_name( $hook ) { global $post; if ( $hook == ‘post-new.php’ || $hook == ‘post.php’ ) { if ( ‘post’ === $post->post_type ) { // Do stuff } } } Script is hooked via: add_action( ‘admin_enqueue_scripts’, array( $this, ‘function_name’ ) ); Is the metabox you are … Read more

Error when adding Meta Boxes, but only when adding 3 with the same callback

instead of deleting and creating a new box, try this to just move the existing boxes add_action(“add_meta_boxes_post”, function () { $listBoxId = [ “tagsdiv-ahtscollectionmakes”, “tagsdiv-ahtscollectionyear”, “tagsdiv-ahtscollectionos”, ]; $screen = get_current_screen(); $page = $screen->id; // loop on the “side” boxes foreach ($GLOBALS[“wp_meta_boxes”][$page][“side”] as $priority => $tabPriority) { foreach ($tabPriority as $id => $box) { if (in_array($id, … Read more