V
V
Viplayer2021-09-23 21:05:05
WordPress
Viplayer, 2021-09-23 21:05:05

Why does $wpdb->update corrupt html code and how to fix it?

I make a request to update a record in the database:

$wpdb->update( 
        $wpdb->prefix . 'table', // указываем таблицу
        array('url' => $_POST['url'],
            'html_code' => $_POST['html_code'],
            'post_type' => $_POST['post_type'],
            'categ_name' => $categ,
            'by_title' => $header
        ), 
        array( // где 
          'ID' => $_POST['post_id']		
        ), 
        array( '%s' ),
        array( // формат для «где»
          '%d',
          '%s',
          '%d',
          '%s',
          '%s',
        )
      );


The code from the wp_editor form comes to html_code, but, let's say, when you upload an image, after the request, extra \" or just \ appear in the image code - why is this and how to fix it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question