Encodes < > & ” ‘ (less than, greater than, ampersand, double quote,
single quote). Will never double encode entities.
Given that, arguably, both of those strings need sanitization. Imagine a site name like >> "My" Website's Great Title <<"
Also, since you are using this in Javascript, you should probably be using esc_js
instead.
The convention is, “understand how markup works, and how malicious hackers work, and act accordingly.” That is how you know how to use these functions. Also, Trust No One.
See also this article from our member Stephen Harris: Data Sanitization and Validation With WordPress
Related Posts:
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Escape when echoed
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- How to be escape Variables and options when echo?
- How to change a user’s password programatically
- Who are the most trusted plugin developers? [closed]
- Get plugin_dir_url() from one level deep within plugin
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- Redirect to settings page after install
- Multiple plugins vs combined one
- Can i create two tables at single time while installation of custom plugin?
- Using add_filter inside another class
- SESSION in WordPress Plugin Development
- WordPress plugin installation error
- How long does it take for a new plugin to be approved?
- WordPress Plugin as ‘Library’ From Abstract Application?
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- Detecting when a custom taxonomy has been changed and display alert?
- How can I get full attachment url from wp_get_attachment_metadata?
- How to make my plugin GDPR compatible?
- Why is the Settings API is not saving my array of options
- Override comments.php template with plugin
- Custom plugins/Manipulated plugins: Always a terrible idea to inherit these types of WP sites that discourage updates? [closed]
- Accessing GET variable named ‘error’
- Why is an action callback function from an instance of a class always invoking the same function from an instance?
- Demystifying and understanding shortcode nomenclature
- download_url() appears as grey icons
- How can I add an options page for my class based plugin?
- Sending WP posts to external API
- Issue with adding count to “subsubsub” aka quick links on custom_post_type
- Register Page Template from Plugin
- Private Plugin Updates – Localhost
- Any hook for pre-plugin-update -either bulk or single plugin update
- wp_create_nonce function doesn’t work inside a plugin?
- Making a plugin only available on the front-end for the logged in super admin
- When to load auto-login code?
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- How to replace WordPress Media Upload Window with user’s device window?
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- How can i change the texts of plugin (created by me) in wordpress admin?
- Setup wp_schedule_event within a custom plugin
- WordPress : Explain Plugins & Theme string value in database
- modify plugin to support RTL
- execute function after one completed
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- Can I use register_settings and unregister_setting once the settings page has loaded?
- Bulk update wordpress posts
- How to automatically add edit link on frontpage post of any wordpress theme?
- Plugin function inside custom plugin
- Is there a plugin for automatically adding a word or symbol after a trigger word? I.e. Like a search and replace but more like search and add? [closed]
- Class or function wrapper for plugin code
- Licensing a Plugin [closed]
- Add a function call after content automatically?
- How to use add_action for multiple instances of the same class
- Plugin option default value
- How can i listing current category and Featured Category post list?
- Ajax request sends url rather than data
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- Security of a WordPress Plugin
- Grouping imported products and showing variations based on selected product
- save_post_product action not firing
- How to get the custom field value using SQL query
- specific rows style for in custom list table using WP_List_Table
- How to add the search page link to the anchor tag?
- How to display the category name in the tab and post inside the tab in WordPress?
- How would I Redirect an existing WooCommerce customer to a specific url after Checkout
- Has blocks gutenberg block multiples registers type in my Plugin
- Ultimate Members Default Post Layout problem
- best way to upload a large file to wordpress using wp all import
- Why do actions with class and public method don’t fire __construct()
- How to define the slug for my custom plugin?
- Custom plugin settings page with tab. Error: “Sorry, you are not allowed to access this page.”
- return bbp_get_topic_author_id as integer
- Dynamic input fields in WordPress Plugin
- Is it possible to create duplicate post on other site (either push, on publish, or pull, periodically)?
- How to add a box note in wordpress plugin page ? top header side.
- Widget outputs the value but doesn’t save anything inside the textarea
- WordPress Widget: Is it possible to make the form dynamic without updating?
- Why some plugins are including wp-includes/plugin.php file?
- Change default url to plugin custom post type
- A more elegant way to handle notices/warnings
- Redirect default login page to a custom page [duplicate]
- appointment plugin doesn’t display all appointments
- Display_rows() and column_cb() strange behaviour
- WordPress plugin options need to delete after deactivate & uninstall
- How can I pass value to function in add_menu_page?
- Doing action based on input from options menu
- Making a Custom Post Type Publish Loop
- What are the downsides of using bootstrap in plugin development?
- How to generate a responsive output from plugin?
- The plugin generated xxx characters of unexpected output during activation
- How to hide a piece of code from a wordpress web page?
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- Someone Comment 1000 times in a Day in My WordPress Site, What Can i Do
- Unable to pass arguments from plugin form to filter hook using ajax, the data is transferring via ajax but unable to pass as arguments in filter hooks
- How to update changes to multiple sites at the same time
- Why am I getting an error when requiring a file in my plugin?
- Running a function using Crown WordPress on one day a week, for example, Mondays of every week
- How to make a Template page to show the information of different things Shop and Product page?