2210 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc says

Hi, few weeks ago I have build my custom admin panel for WordPress everything works fine except one textarea that doesn’t. This textarea is suppose to store users shortcodes which they can display on the home page, for example I input something like this:

[nivo width="935" height="435" effect="random" pauseTime="1000"]
 [image url="wwwhttp://localhost:8888//incorporated/wp-content/themes/incorporated/images/slider/02.jpg" /] 
[image url="http://localhost:8888//incorporated/wp-content/themes/incorporated/images/slider/03.jpg" /] 
[image url="http://localhost:8888//incorporated/wp-content/themes/incorporated/images/slider/04.jpg" /]
 [image url="http://localhost:8888//incorporated/wp-content/themes/incorporated/images/slider/01.jpg" /]
[/nivo]

The shortcode saves, displays correctly on the home page, but it doesn’t output correctly back in the textarea, instead of seeing the above shortcode it clears out the urls, example:

[nivo width="935" height="435" effect="random" pauseTime="1000"] 
[image url="" /] 
[image url="" /]
[image url="" /]
[image url="" /]
[/nivo]

If I try to save just the url without any shortcode it is the same story, it is saved to database I can echo it but it doesn’t display in the textarea ;O Any clue what is going on? For me it has to be magic…

140 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
weblusive says

I think you are somehow escaping special characters in your code. Check if the textbox field is wrapped with any escape function. Or better post the code snippet.

1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs says

I use the ‘Option Framework’ by Devin Price and ran into a similar problem in the past.

For my situation I discovered that the text area was being sanitized with wp_kses and stripping out all HTML including links:

function of_sanitize_textarea($input) {
    global $allowedposttags;
    $output = wp_kses( $input, $allowedposttags);
    return $output;
}

Is your framework doing something similar by chance?

2210 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc says
JamiGibbs said
I use the ‘Option Framework’ by Devin Price and ran into a similar problem in the past.

For my situation I discovered that the text area was being sanitized with wp_kses and stripping out all HTML including links:

function of_sanitize_textarea($input) {
    global $allowedposttags;
    $output = wp_kses( $input, $allowedposttags);
    return $output;
}
Is your framework doing something similar by chance?

Yeah I have build mine on top of option framework, but I already commented the wp_kses but it didn’t help :| I will search maybe there is more then one…

1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs says

Try changing the ‘of_sanitize_textarea’ function to this (inside /admin/options-sanitize.php):

function of_sanitize_textarea($input) {
    global $allowedtags;
    $output = wp_filter_post_kses( $input, $allowedtags);
    return $output;
}

And here’s the Github discussion about Devin’s santization choices in his framework.

2210 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc says
JamiGibbs said
Try changing the ‘of_sanitize_textarea’ function to this (inside /admin/options-sanitize.php):
function of_sanitize_textarea($input) {
    global $allowedtags;
    $output = wp_filter_post_kses( $input, $allowedtags);
    return $output;
}
And here’s the Github discussion about Devin’s santization choices in his framework.

I don’t use this function ;P I had to remove it because I don’t have it anywhere…

2210 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc says

any other idea?

11 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
WpGirl says

stripslashes?

2210 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc says

I have really no clue, I am not validating right now the data in any way, when I do print_t right before assigning it to textarea everything looks ok but in the textarea the links are missing ;/

3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says
mpc said
I have really no clue, I am not validating right now the data in any way, when I do print_t right before assigning it to textarea everything looks ok but in the textarea the links are missing ;/

Do you print the output between the textarea tags or you’re setting the value attribute like for the text fields?

Parker

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by