How to modify Publish metabox?

I always do it with Frank Bültge’s Adminimize in Global Options, you’ll find Your Own Options in the left column you put any name for your reference in the right column you put the ID or Classes you want to hide if I’m not mistaken, you’d want to hide this #visibility.misc-pub-section,.misc-pub-section.curtime.misc-pub-section-last Here’s a reference list … Read more

Creating an “admin only” meta box with WPAlchemy. Getting a fatal error on front-end when using current_user_can

try the following: $custom_admin_mb = new WPAlchemy_MetaBox(array( ‘id’ => ‘_custom_admin_meta’, ‘title’ => ‘Admin only’, ‘template’ => get_stylesheet_directory() . ‘/custom/admin_meta.php’, ‘output_filter’ => ‘my_output_filter’, )); function my_output_filter() { if (current_user_can(‘administrator’)) return true; return false; }

Post Meta not saving when have empty post

It’s default WordPress behavior. You cannot create, save or even trash “empty” posts (considering, for that last case, that you created one manually). Luckily, there’s a filter that allows you to override it and insert / save posts without need for title or content; insert this into your functions.php: add_filter(‘wp_insert_post_empty_content’, ‘__return_false’); I’ve successfully created a … Read more

Problem with meta box in Links

The hook you are after is edit_link (I couldn’t find any documentation). It’s fired from inside wp_insert_link (itself fired whenever a link is created or updated). The action only passes one argument, the link’s ID, to the callback. So you would need to change 2 to 1, on your add_action call: add_action( ‘edit_link’, ‘mytheme_save_data’, 10, … Read more

Setting multiple image urls using WordPress’ Media Uploader

There’re 2 things you should consider: change send_to_editor inside click callback. This will change this function only when needed, e.g. when uploader is shown. This also prevent unwanted things with global variables. You should always backup the send_to_editor. Here’s my sample code (not tested): jQuery(document).ready(function($) { $(‘#upload_image_button_main’).click(function() { var backup = window.send_to_editor; window.send_to_editor = function(html) … Read more