Getting the ID of a meta box

Here’s what I would do in order to get the ID of the metabox, In the Dashboard where the meta boxed are located, open up the Screen Options tab on the upper right corner Open up your browser’s developer tool (ex: Chrome) Use the element selector () and select the checkbox label that is listed … Read more

Custom “Publish” / “Update” button &

You can stimulate click to Update post button like this.. Adding submit or update button to custom metabox? <script> jQuery(‘.metabox_submit’).click(function(e) { e.preventDefault(); jQuery(‘#publish’).click(); }); </script> <input type=”submit” class=”metabox_submit” value=”Submit” />

Use meta box value in CPT as post title

<?php add_action( ‘save_post’, ‘post_updated’ ); function post_updated( $post_id ) { // verify post is not a revision & not an autosave if ( !wp_is_post_revision( $post_id ) && !(defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE) ) { // set the new post title $post[‘ID’] = $post_id; $post[‘post_title’] = get_post_meta($post_id, ‘ecpt_name’, true); // update the post, removing the action … Read more

Add filter ‘wpautop’ to meta box textarea

Add a function that grabs your meta data, applies wpautop and echoes it out, or otherwise run it through when you output it in your template. $my_meta = get_post_meta($post->ID,’_my_meta’,TRUE); echo $my_meta[‘name’]; echo wpautop( $my_meta[‘description’], 1 );

Removing custom meta box added in parent theme

Note: This is the merged version between my and @toscho answers. Explanation (by @toscho) Use add_meta_boxes_page as action hook. You can find the hook in wp-admin/edit-form-advanced.php and it displays as: do_action(‘add_meta_boxes_’ . $post_type, $post); Solution(s) Try the following action, which is inside register_post_type() as well. function wpse59607_remove_meta_box( $callback ) { remove_meta_box( ‘id-of-meta-box’ , ‘page’ , … Read more

Access the environment of an admin page from another admin page

Ok, this could be achieved this way, probably. add_action(‘add_meta_boxes_my_super_duper_post_type’, ‘get_metabox_global_ajax’, 9999 ); function get_metabox_global_ajax(){ if( isset($_GET[‘mgv’]) && $_GET[‘mgv’] == ‘1’ ){ global $wp_meta_boxes; @error_reporting( 0 ); header( ‘Content-type: application/json’ ); die( json_encode( $wp_meta_boxes )); } } Now, you send a request from your plugin page to post-new.php?post_type=my_super_duper_post_type&mgv=1 through ajax, and use the returned json response … Read more