Problem with accents when inserting a personified field in the wordpress panel

Asked

Viewed 55 times

0

Hello friends when I put there "Hemerson Assuncao" sends more when I put with acetos type Assunção does not send example

add_post_meta($id, 'full name','Hemerson Assunção');

Someone of that force There follows my code complete below

<?php
require_once 'wp-load.php';
require_once ABSPATH . 'wp-admin/includes/taxonomy.php';



// Cria o post
$id = wp_insert_post(array(
    'post_title'    => 'Pedido de Gas',
        'post_content'  => $pedido,
       // 'post_date'     => date('Y-m-d H:i:s'),
       // 'post_author'   => $user_id,
        'post_type'     => 'pedidos',
        'post_status'   => 'publish',
));
if ($id) {
    // criacao de categoria
   wp_set_post_terms($id, wp_create_category('gas'), 'category');
    // Campos Pesonalizados
   add_post_meta($id, 'nome_completo','Hemerson Assunção');
   add_post_meta($id, 'endereco',$endereco);
   add_post_meta($id, 'numero',$numero);
   add_post_meta($id, 'bairro',$bairro);
   add_post_meta($id, 'contato',$contato);
   add_post_meta($id, 'troco',$troco);
   add_post_meta($id, 'total',$total);


} else {
    echo "WARNING: Failed to insert post into WordPress\n";
}



?>

  • Don’t send to where?

  • Anything uses utf8_encode.

  • For the wordpress panel

  • No. Where you define your name. Make a variable declaring unnamed inside the utf8_encode and test. Type $name = utf8_encode('Hemerson Assumption');

  • There where you entered your name puts the variable without quotation marks.

  • Like this: <?php $full name = utf8_encode $_POST['full name'];?>

  • 1

    Like this: <?php $full name = utf8_encode($_POST['full name']);?>

  • If it doesn’t, try utf8_decode

  • It worked out my director filet I’ll put a UP for you thanks!

  • I answered. Give as correct answer.

Show 5 more comments

1 answer

1


Do it like this: $nome_completo = utf8_encode($_POST['nome_completo']);

  • I was able to reply to this http://answall.com/questions/175307/acceptcents

  • Rate the answer here as right. You just gave like. I’ll see the other.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.