Upload Button in meta box not opening library

You mentioned that you’ve added the meta box for pages: I have created a custom template, added two metaboxes in Pages using a ‘Page_Fiche_Metier.php’ template. However, in prfx_image_enqueue(), the code only runs if the post type is post. Changing prfx_image_enqueue() so that it checks for the page post type will fix the issue. function prfx_image_enqueue() … Read more

How to inform the user that the save was not successful?

Handling admin notice on Edit Post When action related to post or editpost, we will be faced with redirect_post function. There are two filters you can use to handle the post messages, redirect_post_location and post_updated_messages ( see the list messages at https://core.trac.wordpress.org/browser/tags/4.8/src/wp-admin/edit-form-advanced.php#L135 ). Here the sample code how to handle the messages. Create new message … Read more

How can I make my metabox appear?

I’ve managed to make it work because of @howdy_mcGee’s comment. I did not notice that I had to call the specific post type name of it. my code is now like this and it shows up! function slide_add_post_meta_boxes() { add_meta_box( ‘pukkemukslideshow’, // Unique ID __( ‘Slideshow’, ‘example’ ), // Title ‘slide_post_class_meta_box’, // Callback function ‘slideshow’, … Read more

How to remove plugin metaboxes from edit.php

You can use the do_meta_boxes hook to remove the metaboxes instead. Like below add_action( ‘do_meta_boxes’, ‘vpm_remove_meta_box’ ); function vpm_remove_meta_box() { remove_meta_box( ‘ortext-metabox’, ‘post’, ‘normal’ ); remove_meta_box( ‘ez-toc’, ‘post’, ‘normal’ ); } See this for more info https://developer.wordpress.org/reference/functions/remove_meta_box/

Input value from metabox is not found in $_POST after post save

The $_POST[”] has to contain the name attribute of the input field and not the ID. So to modify your code: function silly_display_metabox( $post ) { wp_nonce_field( basename( __FILE__ ), ‘silly_extrnum_nonce’ ); ?> <label for=”sillyNum”>Silly Number</label> <input type=”number” id=”sillyNum” name=”sillyNum” placeholder=”Write a number…”> <?php } And function silly_save_metabox( $post_id ) { $is_autosave = wp_is_post_autosave( $post_id … Read more