Make metabox always be on top (sticky)
Make metabox always be on top (sticky)
Make metabox always be on top (sticky)
Never mind , i was hooking the metaboxes on plugin_run() Moved them to admin_menu() and now it works OK Regards
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
Metabox on a custom page – How to include the appropriate default scripts and styles?
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
I guess you want to delete all meta values from all posts with this: delete_metadata(‘post’, null, $meta_key, null, true) See the documentation which says, that the last argument is ment to delete all entries from all objects: delete_metadata($meta_type, $object_id, $meta_key, $meta_value=””, $delete_all = false) $delete_all (boolean) (optional) Optional, default is false. If true, delete matching … Read more
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
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.
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
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