The default text widget – WP_Widget_Text
– can be found in wp-includes/default-widgets.php
. The input is handled like this:
stripslashes( wp_filter_post_kses( addslashes( $text ) ) );
for the text;
I assume this should work likewise for your custom widget. Additionally there is:
wpautop( $text )
on the output, if the filter is set to do that;
But optimally you’re taking a look at the source yourself.
Additionally the codex articles:
give you an good overview about sanitizing, escaping and validating possibilities with WP.
Related Posts:
- Limit number of Widgets in Sidebars
- How to load Widget javascript + css files only if used?
- check if registered sidebar is active & has widget content
- Adding iframe Content to Sidebar Widget
- How to use wp_dequeue_style() for style enqueued in WP_Widget class
- Storing custom dashboard widget options in wordpress
- $post>ID displays wrong post ID
- Programmatically edit the text of a widget
- Video Embed in Sidebar Widget with Links to Others in Category
- How can I whitelist only specific shortcodes for processing in text widgets?
- Bookshelf plugin and/or widget [closed]
- Create a Widget Area in the Navigation Bar for the Genesis Theme Framework?
- Manual display of widget
- Add a banner to the Dashboard
- Customized widget area – how to override or filter class xoxo?
- How to access widget data from outside widget?
- How to add a description to Widgets?
- add_page_menu to make shortcut to widgets
- Custom Menus, Widgets & Conditional Statements
- Dynamic widgets
- How do I stop a widget from displaying on mobile site?
- cannot drag and drop widgets since wordpress 3.2.1
- Change recent posts widget title
- Color Picker Showing Twice When Widget Added to Sidebar
- How can I use AJAX to save/update a widget form?
- Display assigned terms with link
- Widget modifications in a child theme
- How to get “Widget Logic” plugin’s input value in a custom widget code (to display on the Widget admin page)
- Extending WP_Widget throws error when Monster Widget used
- Making footer widgets responsive
- Custom html widget with a Joomla-style assigment
- Is there a way to extend the default image widget into a new custom widget and add additional fields to it?
- Conditional Tags Based on Previously Viewed Posts
- Make page jumps in widget
- Query in query for Widget
- How to display first post thumbnail as a background image of a widget?
- Create widget in dashboard displaying a custom user field?
- Widget without DIV wrapper
- Widgets not displaying since 4.3
- Custom widget with WYSIWYG
- Limit number of widgets in widget area
- How to create pagination for homepage with widgetized area?
- Hooking action once but called twice
- How can I add an author-box below a post?
- How to overload the update() of existings widgets?
- Override WordPress Widget CSS Classes?
- Help me out with this Undefined index ?
- displaying tags in a widget
- Dynamic Sidebar and XHTML Validity?
- How to use get_results() in widget front end?
- How to best include widget area just on homepage?
- Remove “Content” and “Discussion” from Right Now Dashboard Widget
- wordpress widgets screen disappeared
- Proper approach to moving complete site from one domain to another AND preserve widgets
- Different widgets in sidebar on sub-children pages?
- Can the qTranslateX-Plugin translate non-article text? [closed]
- Custom widget is not appearing in the admin area
- Static image for embedded YouTube video instead of blank player?
- What conditional to use for dynamic sidebar check?
- Adding a single text input field to a custom Dashboard widget
- How to test if the widgetized area has any widgets?
- Saving widget gets an undefined variable
- Trouble accessing a multidimensional array to add classes to default WordPress widgets
- Distinguish between different widgets of the same type
- links to Media Library content in sidebar per page
- Why is registering a sidebar for each page causing my sidebars to reset?
- How do I customize the positioning of WordPress widgets?
- Limit archive widget results
- How can I detemine the parameters needed by the_widget()?
- Quick Draft widget in weird place on dashboard after being re-added
- Fatal error: Uncaught Error: Class ‘WP_Widget’ not found
- Array showing all values of loop instead of specific value to post
- How can I remove WordPress element IDs and Class names in the HTML?
- Remove widgets on mobile front page without affecting desktop
- Widget display nothing
- How can I have sidebar widgets on Twenty Seventeen theme on all pages?
- Collapsible widgets [closed]
- Loop through Widgets in sidebar using widget array number?
- How to display author meta in a sidebar widget
- Is it ok not to set widget in the main page of a one page WordPress Theme?
- How to get widget content in WordPress based on it’s ID?
- Recent Posts Widget URL / Domain change
- New Custom Widget Call a Different Widget Function
- Loading scripts only if a particular shortcode or widget is present
- Make a widget to my footer
- Always show the widget title in a wordpress widget
- Custom php Widget keeps disappearing from the front end
- Display Posts by Views (Popular Posts Widget)
- Default WordPress widgets always appear
- Insert to wp_footer if widget is found in the sidebar
- Using javascript on the new widget preview / customizer page
- Show editor widgets only on pages that use a specific template?
- Conditionally enable autoplay when using oEmbed in a custom widget
- Options page for widget
- Custom tabs widget don’t work in google chrome, is blocked, do not change the tabs. Why?
- WordPress Hide Widget If $_Session Is Active?
- Post Thumbnails on Sidebar Widgets
- Recent posts with different class name for each post and a scrollbar?
- Classic widgets with 5.9+?
- getBlockVariations(…) is undefined in Widget and Template Part editors but not Post Editor