The Problem
This turned out to be a common case of needing to use stripslashes();
.
How did I figure this out?
I logged into phpMyAdmin, navigated to the options table, found my option name, and edited it.
Here’s what I discovered…
s:11:"description";s:90:"<span style=\"text-decoration: underline;\">This is supposed to be underlined text.</span>";
So obviously my plugin is working. It’s saving stuff properly. The text I entered into the wp_editor();
is there, and the appropriate HTML is wrapping my text as well.
Notice the slashes that have been added automatically. This is what was causing the problem when outputting the contents from the wp_editor();
which were saved in my plugin option.
Simple Solution
- Use
stripslashes();
after retrieving your option data before you
output it. - This should be done on output and not on input.
Related Posts:
- array_map() for sanitizing $_POST
- How to sanitize user input?
- Prevent invalid or empty values from being saved to the database and retain the form field values upon error
- how to save wp_editor html content in options table
- Array/List Edit in Backend
- esc_url, esc_url_raw or sanitize_url?
- framework for plugin/theme options panel? [closed]
- How do I add CSS options to my plugin without using inline styles?
- Adding Custom Text Patterns in the WP 4.5 Visual Editor
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- Is get_option function cached?
- How come `wp_options` table does not have an index on `autoload`?
- Update Option Stored in Multi-Dimensional Array
- What are the advantages to the Settings API?
- Adding Widget form fields dynamically
- Where to store plugin settings fields
- Is get_option() faster than accessing get_transient()?
- How to properly validate data from $_GET or $_REQUEST using WordPress functions?
- What’s the best method for emptying an option created with the Settings API?
- Releasing new plugin version, how to rename old options keys?
- WordPress updates defined vs add_filter?
- What is the difference between esc_html and wp_filter_nohtml_kses?
- Creating Settings Page with dropdowns for Plugin
- How to properly sanitize strings for update_option()
- Load visual editor without custom styling
- How to add a new plugin page under desired Options page?
- Escaping built-in WP function return strings
- What is the difference between strip_tags and wp_filter_nohtml_kses?
- How do I handle multiple Submit buttons in plugin’s option page?
- Deletion of shared options using uninstall.php
- Why won’t register_setting() create a setting?
- Multiple entries in get_option results? or why is _multiwidget set to 1?
- Dropdown list of pages to get page id to store in plugin options
- update_option is not working!
- update_option_{$option} Too Few Arguments
- Save user-specific options in WordPress admin
- How to store accumulate multiple option values in a single array using Options_API
- Creating option to allow user to select the page my plugin content will display on
- Unified Approach for Placing Option Pages
- WordPress plugin options and jQuery
- WordPress Plugin Setting’s POST
- Performance of several get_option() calls
- Extend plugin options page
- Can I use the different settings sections over different pages using the save options group?
- Options API – Validation Callback $input is NULL
- Backslashes being stripped from CSS
- Coding a plugin on WordPress; when should I sanitize? [duplicate]
- Best choice of options/settings framework for plugin/theme development
- Correct way check nonce (security) using old Options API
- How to store a medium amount of options?
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- How to add settings subpage from a plugin to a settings page created in theme?
- Plugin options not being saved or created
- Remove Internal Style Sheet if no Value Provided?
- What could cause my plugin’s options/settings page not to load?
- How to set “Site Address (URL)” programmatically on WP multisite?
- WordPress setting with select – where is my mistake?
- Should I always prefer esc_attr_e & esc_html_e instead of _e?
- Using wp_parse_args to set up Plugin Default Settings
- Custom delete option button in plugin settings
- Storing product price data in the database
- How To Change Post Author Default?
- Editing options pages?
- Multiple options pages validation for a plugin
- Securing/Escaping Output of file content – reading via fread() in PHP
- Append wp_editor to Dynamically created textarea
- WP Editor Issue in Backend
- get_option() not returning expected value from plugin
- Parse form values before sending to options.php
- Update problem with update_option() in combination with register_setting()
- mysql_real_escape_string() vs. esc_sql() in WordPress
- tinymce.get() returns error after ajax request
- Insert/Update values to a table after blogname option etc. is updated
- Access bloginfo, get_option, and plugins_url from a non-core php file
- wordpress how to query wp_options table
- How Can I add Fields in wp-option table?
- wp_editor add media button not working
- Plugin Options Array Set to Undefined
- Checked() function on a multidimensional array
- get_option() will not work without access to wp-config.php
- wordpress is adding a second backslash when I use addslashes
- Creating multiple wp_editer() text fields in for loop — the text/visual switch only works for first editor
- Issue on Checkbox with Custom Option Page
- Make Database query only when option is updated
- The Correct Way to Use Nonce Field without Settings API
- Why would you use esc_attr() on internal functions?
- Settings API: Setting default option via ‘get_option’ fails
- Custom Plugin Options Won’t Update
- Problem with display data from get_option
- custom wp_editor does not save the content in plugin settings
- Use options to control jQuery plugin
- why does get_option( ‘home’ ) not work while using in plugin [closed]
- Plugin Options not saving options and doesn’t work
- What could cause a WP Option to get truncated?
- Decontruct serialized data array from wp_options
- Add multiple checkboxes as single field to Custom Shipping Method Settings Page
- How does one update complex options?
- escape html in jQuery for WordPress
- update_option() passing empty array() but still updating