Block metabox – No expanding, no moving around

Deregistering the postbox script seemed a little bit drastic and as mentioned the “Edit” button for the permalink slug does not work as expected anymore. I actually came up another method which uses filters from WordPress and the functionality of the jQuery UI sortable plugin allowing to cancel the sort when it is issued from … Read more

Undefined function error when creating Custom Meta Box

Try this add_action( ‘add_meta_boxes’, ‘cd_meta_box_add’ ); function cd_meta_box_add() { add_meta_box( ‘my-meta-box-id’, ‘My First Meta Box’, ‘cd_meta_box_cb’, ‘post’, ‘normal’, ‘high’ ); } function cd_meta_box_cb() { echo ‘What you put here, show\’s up in the meta box’; } ps: you have some extra problematic lines, at the top of your code, that I removed, namely: add_meta_box( ‘my-meta-box-id’, … Read more

How to pass variable via $callback_args for add_meta_box

Sometimes an example says more than a thousand words. Here’s a small plugin that will guide you: <?php ! defined( ‘ABSPATH’ ) AND exit; /** * Plugin Name: (#65981) »kaiser« Meta Box example * Plugin URI: http://goo.gl/ls6Q6 * Description: Example showing how to add a meta box with callback args * Author: Franz Josef Kaiser … Read more

Adding submit or update button to custom metabox?

Don’t know if i agree with EarnestoDev answer which is more of an opinion then an answer based on facts and not true in all cases, since you can use jQuery to trigger the submit event when a different element is clicked, so just add this js code once <script> jQuery(‘.metabox_submit’).click(function(e) { e.preventDefault(); jQuery(‘#publish’).click(); }); … Read more

How do I create a meta box for dates?

If you’re in need of Meta Boxes for WordPress, check out the amazing code in github by jaredatch. https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress This allows you to add all sorts of metaboxes to your WP theme (or plugin). Date Picker, file upload, wysiwyg, text areas, text boxes…it’s really amazing and saves lots of time.

Tinymce/WordPress is removing all line-breaks?

You may need to use one of the following configuration parameters: // Don’t remove line breaks ‘remove_linebreaks’ => false; // Convert newline characters to BR tags ‘convert_newlines_to_brs’ => true; WordPress passes an $init argument array to TinyMCE that sets the opposite value for each of these parameters. I assume you can pass them directly in … Read more