Best practices for meta box placement?

It is hard to declare best practices here. The placement depends on the content of the metabox: an editor field would be too narrow usually in the side column; two small checkboxes on the other hand will look lost in the main column. To understand where which box will be placed, let’s use a small … Read more

Make Custom Metaboxes Collapse by Default

To display a metabox collapsed or closed by default, it is good to know that adding closed to it’s class attribute will display it closed. All meta-boxes main divs that have closed in their classname, are displayed in the closed form. When the arrow is clicked it will be removed or added (toggled). This is … Read more

Remove the Yoast SEO Post Metabox [closed]

On remove_meta_box is a note: Because you can’t remove a meta box until it’s been added, it’s important to make sure your call to remove_meta_box() happens in the right sequence. WordPress SEO adds meta boxes on add_meta_boxes action with default priority – 10, which run after admin_init, so that won’t remove them. Instead you need … Read more

Remove the Featured Image Meta Box

I haven’t had time to test this but this looks like it should work for you. add_action(‘do_meta_boxes’, ‘remove_thumbnail_box’); function remove_thumbnail_box() { remove_meta_box( ‘postimagediv’,’post’,’side’ ); } Check this for more info. Edit: The main change here is that you need to attach the function to do_meta_boxes instead of admin_menu

Add default WordPress tag meta box to User Profile

This code works for me. It uses ‘locations’ custom taxonomy and ‘suggest’ javascript. You need to extend it to support multiple term selection. Add custom field to user-edit screen and store metadata when user/admin updates profile // for account owner add_action(‘show_user_profile’, ‘add_custom_user_profile_fields’); add_action(‘personal_options_update’, ‘save_custom_user_profile_fields’); // for admins add_action(‘edit_user_profile’, ‘add_custom_user_profile_fields’); add_action(‘edit_user_profile_update’, ‘save_custom_user_profile_fields’); function add_custom_user_profile_fields($user) { printf( … Read more

Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?

Have a look at this list: http://codex.wordpress.org/Plugin_API/Action_Reference It doesn’t matter which one you use as long as it’s not too early and not too late. It’s best to use intuitive and predictable hooks, so add_meta_boxes is preferred. Someday in the future WordPress may change something and by using the most appropriate hooks you increase your … Read more

Taxonomy dropdown metabox in the back-end

Here is an example. I have also created a Gist with more generic code. add_action(‘add_meta_boxes’, ‘my_custom_metabox’); function my_custom_metabox() { add_meta_box(‘custom-taxonomy-dropdown’,’Brands’,’taxonomy_dropdowns_box’,’post’,’side’,’high’); } function taxonomy_dropdowns_box( $post ) { wp_nonce_field(‘custom-dropdown’, ‘dropdown-nonce’); $terms = get_terms( ‘brands’, ‘hide_empty=0’); $object_terms = wp_get_object_terms( $post->ID, ‘brands’, array(‘fields’=>’ids’)); // you can move the below java script to admin_head ?> <script type=”text/javascript”> jQuery(document).ready(function() { jQuery(‘#custombrandoptions’).change(function() … Read more

How To Remove The “+ Add New Category” Link From A Category Metabox

The default metaboxes are registred in the file wp-admin/includes/meta-boxes.php. There you can find the function post_categories_meta_box() which will generate the taxonomy metabox. Currently there is no hook available to filter the output. But you can do one of the following: Use remove_meta_box() to remove the existing category metabox and register your own with add_meta_box(). Copy&Past … Read more

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