Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Optionally pass WYSIWYG field data through wpautop() #264

Merged
merged 2 commits into from

2 participants

@GawainLynch

Don't pass WYSIWYG field data through wpautop() if the new 'raw' parameter is set. Backwards compatible.

GawainLynch added some commits
@GawainLynch GawainLynch Don't pass WYSIWYG field data through wpautop() if the new 'raw' para…
…meter is set. Backwards compatible.

Signed-off-by: Gawain Lynch <gawain.lynch@gmail.com>
fdd1653
@GawainLynch GawainLynch Add 'raw' parameter to WYSIWYG demo field. Set to FALSE (default).
Signed-off-by: Gawain Lynch <gawain.lynch@gmail.com>
b0660e0
@rilwis rilwis merged commit 2f7b6af into rilwis:master
@rilwis
Owner

Although this is a good idea, we should normalize this attribute for wysiwyg fields in normalize_field function.

@GawainLynch

Added in #267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 30, 2013
  1. @GawainLynch

    Don't pass WYSIWYG field data through wpautop() if the new 'raw' para…

    GawainLynch authored
    …meter is set. Backwards compatible.
    
    Signed-off-by: Gawain Lynch <gawain.lynch@gmail.com>
  2. @GawainLynch

    Add 'raw' parameter to WYSIWYG demo field. Set to FALSE (default).

    GawainLynch authored
    Signed-off-by: Gawain Lynch <gawain.lynch@gmail.com>
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +2 −0  demo/demo.php
  2. +1 −1  inc/fields/wysiwyg.php
View
2  demo/demo.php
@@ -263,6 +263,8 @@
'name' => 'WYSIWYG / Rich Text Editor',
'id' => "{$prefix}wysiwyg",
'type' => 'wysiwyg',
+ // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save
+ 'raw' => false,
'std' => 'WYSIWYG default value',
// Editor settings, see wp_editor() function: look4wp.com/wp_editor
View
2  inc/fields/wysiwyg.php
@@ -45,7 +45,7 @@ static function add_actions()
*/
static function value( $new, $old, $post_id, $field )
{
- return wpautop( $new );
+ return ( $field['raw'] ? $new : wpautop( $new ) );
}
/**
Something went wrong with that request. Please try again.