1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Framework Locations
  5. Comment Metabox Options

Comment Metabox Options

The WordPress Studio Framework can also be used to extend the Comment metabox with custom fields.

Comment Metabox Framework Arguments

titlestring Title of the comment metabox
data_typestringserializeDatabase save option type (serialize | unserialize)
prioritystringdefaultThe priority within the context where the boxes should show. (high | low | default)
show_restoreboolfalseFlag to display restore button of the comment metabox
themestringdarkThe theme framework (dark | light)
classstring Extra CSS classes (space separated) to append to the main framework
defaultsarray Sets all default values from an external array (optional)

Comment Metabox Framework Example

// Check to see if the WPSF class exists
if ( class_exists( 'WPSF' ) ){

  // Set unique slug ID
  $prefix = 'custom_comment_options';

  // Create comment metabox
  WPSF::createCommentMetabox( $prefix, array(
    'title' => 'Custom Comment Options',

  // Create section
  WPSF::createSection( $prefix, array(
    'fields' => array(
        'id' => 'example-text',
        'type' => 'text',
        'title' => 'Example Text',
        'id' => 'example-textarea',
        'type' => 'textarea',
        'title' => 'Example Textarea',
        'id' => 'example-select',
        'type' => 'select',
        'title' => 'Example Select',
        'options' => array(
          'option1' => 'Option One',
          'option2' => 'Option Two',
          'option3' => 'Option Three',

Extract Option Value (data_type => serialize)

$meta = get_comment_meta( get_comment_ID(), 'custom_comment_options', true );

echo $meta['example-text'];
echo $meta['example-textarea'];

Extract Option Value (data_type => unserialize)

echo get_comment_meta( get_comment_ID(), 'example-text', true );
echo get_comment_meta( get_comment_ID(), 'example-textarea', true );
Was this article helpful to you? Yes No

How can we help?