Modifying the main editor priority

The editor is hard-coded into the form. It isn’t inserted by add_meta_box. There is a hook called edit_form_after_title which you should be able to use though. Proof of concept: // use the action to create a place for your meta box function add_before_editor($post) { global $post; do_meta_boxes(‘post’, ‘pre_editor’, $post); } add_action(‘edit_form_after_title’,’add_before_editor’); // add a box … Read more

Getting jQuery sortable items in custom metabox

It’s a matter of wrapping the jQuery into document.ready, add a handler to the items and configure the sortable: add_action( ‘add_meta_boxes’, ‘metabox_wpse_66122’ ); function metabox_wpse_66122() { add_meta_box( ‘my_sortable’, __( ‘My Sortable’ ), ‘sortable_wpse_66122’, ‘post’ ); } function sortable_wpse_66122() { echo ‘<ul class=”sortable ui-sortable”>’; $posts = get_posts( array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => … Read more

How to insert Gallery shortcode to a meta box

That is a weird way to do it, shortcodes are really meant for inserting into the editor, if you want to program some functionality it’s better to go straight into the template/code itself. //check if post format is gallery type if ( has_post_format( ‘gallery’ ) { echo do_shortcode(”); }

Remove a plugin meta box from the dashboard

I found that this works: add_action(‘admin_init’, ‘rw_remove_dashboard_widgets’); function rw_remove_dashboard_widgets() { remove_meta_box(‘wpdm_dashboard_widget’, ‘dashboard’, ‘normal’); } I guess ‘admin_init’ is the key, so that it runs before the dashboard is loaded.

Add pre-existing meta box to new custom post type

This depends on how your parent theme hooks in the meta_boxes. If the callbacks are hooked to add_meta_boxes and written similar to the following from the Codex: function myplugin_add_meta_box() { $screens = array( ‘post’, ‘page’ ); foreach ( $screens as $screen ) { add_meta_box( ‘myplugin_sectionid’, __( ‘My Post Section Title’, ‘myplugin_textdomain’ ), ‘myplugin_meta_box_callback’, $screen ); … Read more

add_meta_boxes action with refresh on save

So I managed to cobble something together with a bit of javascript… It’s hacky but somewhat elegant I think. add_action(‘admin_init’, function () { if ( current_user_can(“send_notifications”) ) { $post_types = [“post”, “go_live”]; foreach ($post_types as $post_type) { add_meta_box( ‘cabtv_notif_on_post’, ‘Notifications’, function ($post) { wp_nonce_field( ‘cabtv_notif_metabox’, ‘cabtv_notif_metabox’ ); $sent = (bool) get_post_meta( $post->ID, ‘cabtv_notifications_sent’, true ); … Read more

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