Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuadavidnelson/11220818 to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/11220818 to your computer and use it in GitHub Desktop.
Fixing the wp_editor error in WordPress 3.9
/**
* This is the correct method of using wp_editor()
**/
// Codex usage:
wp_editor( $content, $editor_id, $settings = array() );
// Example of proper use in a widget
wp_editor( 'content', 'content', array( 'textarea_name' => $this->get_field_id( 'content' ), ) );
// Alternate method when get_field_id is not available (options page or other)
// Change settings_field_name[content] to the correct settings field and field name
wp_editor( 'content', 'content', array( 'textarea_name' => 'settings_field_name[content]' ), ) );
/**
* This is how NOT to do it
**/
// Codex usage:
wp_editor( $content, $editor_id, $settings = array() );
// Example of inproper use (in a widget)
wp_editor( 'content', $this->get_field_id( 'content' ) );
// Example of inproper use elsewhere
// Change settings_field_name[content] to the correct settings field and field name
wp_editor( 'content', 'settings_field_name[content]' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment