- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
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…
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.
- Envato Staff
- Sold between 100 000 and 250 000 dollars
- Support Staff
- United States
- Author had a Free File of the Month
- Microlancer Beta Tester
- Beta Tester
- Interviewed on the Envato Notes blog
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?
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
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…
- Envato Staff
- Sold between 100 000 and 250 000 dollars
- Support Staff
- United States
- Author had a Free File of the Month
- Microlancer Beta Tester
- Beta Tester
- Interviewed on the Envato Notes blog
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.
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
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…
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
any other idea?
stripslashes?
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 50 and 99 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
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 ;/
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
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
