First let me say, I'm overwhelmed so I'm reaching out for some help.
I have a custom form in Wordpress Admin area. One of the form fields (textarea) is using wp_editor.
<?php wp_editor( $content, 'body-content', $settings = array('textarea_rows'=>'10') );
This works great and so far so good. When I am setting up the array to pass to the
$wpdb->insert( $my_table, $array_data); is where I'm lost and confused and overwhelmed.
I started out using strip_tags and stripslashes but the output to another page didn't display the desired content.
I then tried
htmlentities($_POST['content']); which is saving the data to the database as
this is some text with <a href=\"https://www.google.com\">links</a>. When I output to the page using
html_entity_decode( $array->content ), the link isn't clickable (when I mouseover the text, I see
http://localhost:8888/"http://www.google.com". I believe the issue is with the
\ not being removed on the output or being added unnecessarily on the saving to the database. If I manipulate the value in the database and remove the
\ and then check the output web page again, the text is clickable. I'm so close and just need a little more guidance to help me across the finish line.
UPDATED As a follow up comment, part of what is overwhelming me is I can't figure out if my issue is the way the data is being saved or the way the data is being retrieved and displayed. If the data would save without escaping the double quotes, I think I'd have it.