2178 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator 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
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • United States
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 been a member for 4-5 years
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • United States
  • Has attended an Envato Live event
  • Author had a Free File of the Month
  • Envato Studio (Microlancer) Beta Tester
  • Contributed a Blog Post
  • Beta Tester
+6 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?

2178 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator 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 been a member for 4-5 years
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • United States
  • Has attended an Envato Live event
  • Author had a Free File of the Month
  • Envato Studio (Microlancer) Beta Tester
  • Contributed a Blog Post
  • Beta Tester
+6 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.

2178 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator 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…

2178 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator says

any other idea?

11 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
WpGirl says

stripslashes?

2178 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator 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
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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

by
by
by
by
by
by