Attach Files Metabox

For the part of opening a lightbox, browse for something and then performing something on an action within: WordPress has this already build in. For what you ask is basically the thickbox that opens up like in the post editor when you browse for an image in the gallery. You find all the code you … Read more

Is there a filter/action to add content to WP admin metaboxes?

I couldn’t find a hook so I went with the JS option. add_action( “admin_head-post-new.php”, ‘meta_box_instruction’ ); //new post add_action( “admin_head-post.php”, ‘meta_box_instruction’ ); //edit post function meta_box_instruction($d) { global $post; if($post->post_type == ‘{YOUR POST TYPE}’ || $_GET[‘post_type’] == ‘{YOUR POST TYPE}’): ?> <script type=”text/javascript”> jQuery(document).ready(function(){ jQuery(‘<p>Some instruction</p>’).insertBefore(‘#taxonomy-{YOUR TAXONOMY NAME}’).parent(); }); </script> <?php endif; }

Remove metabox from specific page template in admin

Those are 2 different things: Hide only in one Page Hide only when Page uses a specific template Case 1 – in this example the Page ID is 3, but note that the removals are for page and post alike: add_action( ‘admin_menu’, ‘remove_post_meta_boxes’ ); function remove_post_meta_boxes() { if( isset( $_GET[‘post’] ) && $_GET[‘post’] == ‘3’ … Read more

Changing the priority of a custom taxonomy’s metabox

As is often the case in WP, there are a number of ways to attack this problem. Here’s one possible way: function my_meta_box_order() { global $wp_meta_boxes; $genre = $wp_meta_boxes[‘post’][‘side’][‘core’][‘genrediv’]; unset($wp_meta_boxes[‘post’][‘side’][‘core’][‘genrediv’]); $wp_meta_boxes[‘post’][‘side’][‘core’] = array(‘genrediv’ => $genre) + $wp_meta_boxes[‘post’][‘side’][‘core’]; } add_action(‘add_meta_boxes_post’, ‘my_meta_box_order’); # We’re hooking into: do_action(‘add_meta_boxes_’ . $post_type, $post); $wp_meta_boxes holds all the meta box information. … Read more