I have a plugin I've written that displays ratings on various pages on my site. It's shortcode based and just drops in on any given page


It draws from a field provided by the WP SSO plugin: review rating. The problem is that field is buried pretty deep in several nested panels and I'd like to make it easier for my writers to fill out. I did some experimenting and it looks like I could target the field and update it with JavaScript.

So my question is how hard would it be to include an admin component that.

  1. Showed up only on "Review" custom post type pages
  2. Displayed a box in a specific location in the right sidebar
  3. Included a field for "rating", that when entered would simply update the deeply nested field, but would not itself be considered as part of the post record when submitted?

enter image description here

Note that while I've written a half dozen or so plugins, none of them have dealt with WP Admin, so links to good resources for developing in that area would also be appreciated.

1 Answer 1


It's really easy, it's called meta box and you can create one with the following code.

 * Register meta box(es).
function plugin_prefix_register_meta_boxes() {
    add_meta_box( 'meta-box-id', __( 'My Meta Box', 'textdomain' ), 'plugin_prefix_my_display_callback', 'custom_post_type' );
add_action( 'add_meta_boxes', 'plugin_prefix_register_meta_boxes' );

 * Meta box display callback.
 * @param WP_Post $post Current post object.
function plugin_prefix_my_display_callback( $post ) {
    // Display code/markup goes here. Don't forget to include nonces!

 * Save meta box content.
 * @param int $post_id Post ID
function plugin_prefix_save_meta_box( $post_id ) {
    // Save logic goes here. Don't forget to include nonce checks!
add_action( 'save_post', 'plugin_prefix_save_meta_box' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.