In your code json_encode() function causes to add second backslash on the following line.
$data = json_encode($item_data);
Add the following code in place of above code so it will replace double backslashes with single backslash in data returned by json_encode function.
$data = str_replace("\\\'","\\'",json_encode($item_data ));
Visit following links for more information on json_encode function.
json_encode function Predefined Constants
Tell me whether it resolved your problem or i will find another solution for it.
Related Posts:
- oneOf two possible objects in WP REST API?
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- How to properly validate data from $_GET or $_REQUEST using WordPress functions?
- What is the difference between esc_html and wp_filter_nohtml_kses?
- What is the difference between strip_tags and wp_filter_nohtml_kses?
- How to: Rest endpoint returning empty object
- get all products of one category
- array_map() for sanitizing $_POST
- Coding a plugin on WordPress; when should I sanitize? [duplicate]
- Generate dynamic page through data from another page
- How to sanitize user input?
- WP_Editor – Saving Value into Plugin Option – Stripping HTML
- Why does wp_remote_post returns an empty body response on certain endpoints?
- How to enqueue or include json file to a plugin
- Prevent invalid or empty values from being saved to the database and retain the form field values upon error
- wordpress JSONAPI introspector always limits number at 10?
- json_decode does not work on WordPress
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- How to write a shopping queue line plugin with a queue button?
- Showing results from json-string in WordPress search results page
- GET request return value as error instead of success
- Sanitize WordPress Array Input?
- ajax response strips multidimensional array and unable to decode
- do I need to sanitize a shortcode’s function input?
- Array/List Edit in Backend
- Developing a plugin, ran it through P3 Profiler, shows up slow, but I don’t know why
- Is it possible to make WordPress as a RESTful app?
- Sanitize and Save metabox values
- Programmatically creating posts based on external JSON feed (asynchronously)
- esc_url, esc_url_raw or sanitize_url?
- Sanitization of register_setting()
- Is there a way to use MySQL JSON functions in meta queries?
- Objective Best Practices for Plugin Development? [closed]
- add_menu_page() with different name for first submenu item
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- How to include PHP files in plugins the correct way
- How can I add an image upload field directly to a custom write panel?
- A tool to analyze rewrite rules? [closed]
- Difference Between Filter and Action Hooks?
- framework for plugin/theme options panel? [closed]
- Creating a table in the admin-style?
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- Settings API with arrays example
- How to get the path to the current theme?
- How to make a plugin require another plugin?
- ajaxurl not defined on front end
- What process do you use for WordPress development? [closed]
- What’s the difference between term_id and term_taxonomy_id
- Should I use wpdb prepare?
- Why does WordPress use outdated jQuery v1.12.4?
- Post meta vs separate database tables
- Is there any plugin development framework
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How to add a javascript snippet to the footer that requires jQuery
- Enhance Media Manager for Gallery
- How do I create a custom role capability?
- How do I add CSS options to my plugin without using inline styles?
- How do i best handle custom plugin page actions?
- Adding Custom Text Patterns in the WP 4.5 Visual Editor
- Automatically determine minimum WordPress version required for a plugin?
- What is the advantage of using wp_mail?
- How to make a WordPress plugin translation ready?
- How many times will this code run? (or, how rich is grandma?)
- How to create an API for my plugin?
- Is it ever okay to include inline CSS in plugins?
- Plugins in symlinked directories?
- How to override existing plugin action with new action
- How to include a file using get_template_part() in a plugin?
- Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1
- How to store username and password to API in wordpress option DB?
- body_class hook for admin pages
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is it mandatory to use $wpdb->prefix in custom tables
- Which hook should be used to add an action containing a redirect?
- add_action hook for completely new post?
- Why does WordPress add 0 (zero) to an Ajax response?
- What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
- How to enqueue JavaScripts in a plugin
- Plugin Form Submission Best Practice
- How to redirect to settings page once the plugin is activated?
- Is get_option function cached?
- Should Plugin Folders Include a Blank index.php File?
- Unit testing for plugin development
- Methods of Integrating Plugin Data with Themes
- What is the wordpress wp-includes folder for?
- WordPress Update Plugin Hook/Action? Since 3.9
- How to include jQuery and JavaScript files correctly?
- How come `wp_options` table does not have an index on `autoload`?
- PHP error with shortcode handler from a class
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- Best way to abort plugin in case of insufficient PHP version?
- WordPress Plugin Development – Headers Already Sent Message
- WP 3.3 How to Add Menu Items to the Admin Bar?
- dbDelta not creating tables
- Custom Widget function in Plugin not working?
- Passing arguments to a admin menu page callback?
- Single functions.php or split into many small files?
- Get page content using slug
- $_POST form request with admin-post