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?
- 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?
- 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()?
- What’s the best method for emptying an option created with the Settings API?
- Releasing new plugin version, how to rename old options keys?
- How to properly sanitize strings for update_option()
- Load visual editor without custom styling
- 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?
- Dropdown list of pages to get page id to store in plugin options
- update_option is not working!
- 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?
- 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
- 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?
- Should I always prefer esc_attr_e & esc_html_e instead of _e?
- Using wp_parse_args to set up Plugin Default Settings
- Storing product price data in the database
- Multiple options pages validation for a plugin
- 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
- Insert/Update values to a table after blogname option etc. is updated
- 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
- 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
- custom wp_editor does not save the content in plugin settings
- 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
- Adding the image selector/uploader to an admin back page
- Sanitize WordPress Array Input?
- do I need to sanitize a shortcode’s function input?
- Plugins Settings page not updating
- How to create plugin settings page for each admin user?
- wp_editor embed shortcode not working within my plugin
- Plugin setting page – update_option problem
- add_settings_error on validating plugin options API
- Cannot save settings value
- How to fetch the post content from the wordpress editor before it can be saved(published)?
- What should I use instead of get_blog_option?
- Tie specific functions to options-update for limiting API requests
- Can’t switch theme after activation
- the correct way to use options from settings page [closed]
- Add_menu_page and saving settings
- Saving multiple fields as array
- Options don’t save, validation callback not executed
- Menu_slug used for creating options page
- Modify a Themes Appearance >> Header admin screen from a plugin
- oneOf two possible objects in WP REST API?
- Settings API not Saving to Database or Display
- Admin Message after Plugin Option Updated
- Sanitize and Save metabox values
- How do I display and edit other posts within the ‘Edit Post’ area of Wp-Admin Dashboard