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?
- WP 3.3 How to Add Menu Items to the Admin Bar?
- Unit tests – Dealing with dependencies
- Changing Plugin Load Order
- Should I create a theme or a plugin?
- How should you hook a session_start() when authoring a plugin?
- How to change wordpress post title?
- How to create a plugin that only operates on the home page?
- Adding callback function for wp_ajax_ has no effect
- How to properly modify get_userdata in plugin to get roles to update in database
- Create a plugin to change the action to which a function is hooked
- Why is the reset password key missing in the reset password email?
- Paging on a future post loop?
- How to pass custom options from widget form to widget update callback?
- How can I add a field to make link nofollow to the WordPress Link Inspector Window?
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- How to show large image in checkout page using WP Ecommerce plugin [closed]
- Why do I need to check if wp_nonce_field() exists before using it
- settings_fields() doesn’t work for other roles except admin
- edit_{$taxonomy} | Hook
- Worpdress cannot create directory
- how to make custom bulk actions for a WP_List_Table (core class)
- Get name and email of current unregistered user, who has recently submitted name and email in comment form?
- How to associate an existing user to a site in a multisite setup programmatically
- Changing upload dir in a plugin regardless of post type
- Auto save permalink setting page with the plugin activation
- creating custom function to log actions in plugin
- Alter post object before display
- Howto: Use Custom Post Types as Submenu Items in Admin
- Show custom data instead of 404
- How to localize admin.php only once
- What’s the right way to instantiate new blocks and/or the plugin itself in toto when using wppb architecture?
- How can I get a list of CPT inside a plugin file?
- Creating a custom Gutenberg block with columns
- Serve text/html from wp-json API via WPEngine, headers not being set properly
- Add a new confirmation page before saving
- Plugin is not generating title tags on any pages or posts
- Plugin Development/ Stop CSS clashes.
- WordPress debug messages not displaying
- Show message from backend
- Cannot change caption for a plugin
- PHP File_exist() not working – Checking if File Exist in WordPress Theme Directory
- Woocommerce inventory [closed]
- Add a check box in Menu Settings
- how to load the comment template from a plugin
- Is there any way to fire heartbeat API from for website visitors?
- Look for a file in a theme before loading from plugin
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- How can I prevent ‘500 internal server error’ because of a long install process?
- Displaying custom content from a plugin within the active theme
- Downloading File via headers doesnt work
- Custom plugin & calling REST api of wordpress instance the plugins is running on
- Add variables from rewrite rules to query var
- How do I specify where to save the debug.log?
- WordPress custom url without using any of the custom tags given
- How to call a plugin function from a page
- Code for cron to delete posts that contain specific expression (e.g. “unable to fetch” every 30 minutes
- How to fetch the post content from the wordpress editor before it can be saved(published)?
- pull data from wordpress database
- How does one set cookies in WordPress without getting the ‘headers not sent’ error? within WP
- Object Oriented plugin, add action and variables
- Glyphicons Dont Show in WordPress Plugin Only
- Change the search results header from plugin
- Tracing dashboard publish settings from input form in WordPress
- Add query string variables to all hyperlinks URL matching a specified domain
- Virtual Page with Registration form
- Is there such a thing as a WordPress console?
- Images not displaying on live server
- redirect word-press page with page values
- Forcing the Uninstall Hook to fail