Last active
August 29, 2015 14:00
-
-
Save joshuadavidnelson/11220818 to your computer and use it in GitHub Desktop.
Fixing the wp_editor error in WordPress 3.9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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