Skip to content
ajitbohra edited this page Dec 1, 2014 · 19 revisions

A WYSIWYG editor field.

wysiwyg

Args

Required args

  • id (string) (required)
  • name (string) (required) Field display name. Used as field label.
  • type 'wysiwyg' (string) (required)

Field Specific Args

Optional Generic Args

See Optional Generic Args

Example Usage

array(
	'id'   => 'example-field-wysiwyg',
	'name' => 'A WYSIWYG editor field',
	'type' => 'wysiwyg',
	'options' => array(
		'textarea_rows' => 5
	)

),

Using WYSIWYG field data in your theme

The data is stored using double line breaks instead of paragraph tags - similar to the way WordPress handles the post content. When outputting the data, typically you would want to convert these line breaks to paragraph tags. Use the WordPress function wpautop to do this.

// Note 3rd param is false to retrieve all meta entries with the same key (Default is false)
$field_data = get_post_meta( get_the_id(), 'example-field-wysiwyg', false );

echo wpautop( $content );