How to remove the RichText Meta Box

Unfortunately, it’s not possible to remove it like a metabox, since it isn’t one. However, there’s a very easy way to get rid of it for a custom post type. If you don’t define anything for the ‘supports’ argument in the registration function, your post type will default to ‘supports’ => array( ‘title’, ‘editor’ ), … Read more

How to List all Sidebars in a Metabox

Try this: <?php $sidebar_options = array(); $sidebars = $GLOBALS[‘wp_registered_sidebars’]; foreach ( $sidebars as $sidebar ){ $sidebar_options[] = array( ‘name’ => $sidebar[‘name’], ‘value’ => $sidebar[‘id’] ); } ?> This prints out( with my registered sidebars ): Array ( [0] => Array ( [name] => Language Menu [value] => sidebar-1 ) [1] => Array ( [name] => … Read more

meta content on required pages

After too many tries i have found following solution myself, but this could save others time. $pid = (isset($_GET[‘post’]) ? $_GET[‘post’] : $_POST[‘post_ID’]); $page_att = get_page( $pid ); $page_parent = $page_att->post_parent; if(15 == $page_parent){ //register metabox }

Is there a predefined callback function for custom categories?

The callback you’re looking for is post_categories_meta_box which we can use via a custom callback. // Add your custom meta box. function your_custom_meta_box() { add_meta_box( ‘your-custom-meta-box’, ‘Custom Meta Box’, ‘my_taxonomy_meta_box_cb’, ‘post’, ‘side’, ‘high’, null ); } add_action( ‘add_meta_boxes’, ‘your_custom_meta_box’ ); // Our custom callback. function my_taxonomy_meta_box_cb( $post, $box ) { // Pass in the taxonomy … Read more

How do I stop HTML entities in a custom meta box from being un-htmlentitied?

If I’m allowed to answer my own question here: I found a way to stop the conversion of my html entities back to characters by using <?php esc_textarea( $text ) ?>, as detailed by the codex here: http://codex.wordpress.org/Function_Reference/esc_textarea. Not sure if this is the right way of doing it, but its working. My (snipped) metabox … Read more

Display list of tags as drop down menu or radio buttons in a meta box?

In my last project i had the same issue and i just used this: first get the list of tags to a var using the get_categories function by passing the right taxonomy like this: $args = array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 0, ‘taxonomy’ => ‘post_tag’ ); $categories=get_categories($args); foreach($categories as $category) { … Read more

How to make multicheck for post/page meta box

The post metadata can store multiple values either as distinct entries in the postmeta table, or as one entry with the value as a serialized PHP array. The serialization may require less code, but the distinct entries allow faster querying later (“give me all posts that have at least option A of the multicheck checked”). … Read more