How can you tie into the tag metabox?

Here’s a workaround specific for the post tags meta box. We can register a custom metabox callback for the post_tag taxonomy with: add_filter( ‘register_taxonomy_args’, function( $args, $taxonomy ) { // Replace the original (post_tag) metabox callback with our wrapper if( ‘post_tag’ === $taxonomy ) $args[‘meta_box_cb’] = ‘wpse_post_tags_meta_box’; return $args; }, 10, 2 ); where our … Read more

How to group meta boxes on the post edit page

Thanks for the hint Bainternet, indeed this is very easy to implement with jQuery. Example (the four meta boxes are closed for clarity) : Here’s what I did : var $j = jQuery.noConflict(); $j(document).ready(function() { $j(“#side-sortables”).append(‘<div id=”container_div” class=”postbox meta-box-sortables ui-sortable”><div class=”handlediv” title=”Click to toggle.”><br></div><h3 class=”hndle”><span>Container Meta Box</span></h3><div id=”container_inside” class=”inside”></div></div>’); $j(“#my_metabox_div”).appendTo(“#container_inside”); $j(“#my_other_metabox_div”).appendTo(“#container_inside”); etc… }); I added … Read more

How to add multiple images to a custom post type single post?

Thanks for the suggestions, guys. I did some more research, and found this – https://wordpress.org/plugins/attachments/ It’s a great plugin that lets you attach images to the post without inserting them in the post and the images can be easily sorted with ajax, it’s also quite modifiable and just what I needed, and works on custom … Read more

How do you remove a Category-style (hierarchical) taxonomy metabox?

Non-hierarchical taxonomies (like tags) use tagsdiv-{$tax_name}. Hierarchical taxonomies (like categories) use {$tax_name}div. This is for historical reasons: categories were placed in categorydiv, tags in tagsdiv. When support for multiple non-hierarchical taxonomies was added, the tagsdiv name was expanded to tagsdiv-{$tax_name}. When finally multiple hierarchical taxonomies were made possible, they choose to generalize categorydiv to {$tax_name}div.

Dashboard like meta boxes in my plugin – how to save their position and open/closed state?

When ordering or closing metaboxes, those actions require nonces, add the following to your code and see if that resolves the problem. <?php wp_nonce_field(‘closedpostboxes’, ‘closedpostboxesnonce’, false ); ?> <?php wp_nonce_field(‘meta-box-order’, ‘meta-box-order-nonce’, false ); ?> Additional: You should add metaboxes to your page using add_meta_box and output them using do_meta_boxes passing in the hook for your … Read more

Save checkbox value in metabox

This isn’t a WP question, but moreso a general form issue. Regardless, a checkbox will not pass anything if unchecked, and 1 or on if checked. // Sanitize user input. $my_data = $_POST[‘home_slider_display’] ? true : false; // Update the meta field in the database. update_post_meta( $post_id, ‘home_slider_display’, $my_data );

Removing meta boxes: remove-meta_box() or unset()?

When in doubt use the API. Let’s say the structure of $wp_meta_boxes will change or go away one day. remove_meta_box() will still work, because the API is a contract between core and developers. Unsetting some keys in a global variable might break. unset() is easier to write when you want to remove a whole group: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)