Support » Developing with WordPress » Problem with data collection in tables

  • I have the following to do. I am migrating web content from a joomla to a WordPress, and the problem that I present is that the joomla has a collection of data in tables that is not compatible with WordPress, when I use the wordpress hook

    wp_insert_post

    It does not save the field with the data that I need to convert to another collection to be able to save them with their respective accents.

    I hope you understand me.

    I have the following

    $id = wp_insert_post(array(
    ‘post_title’ => utf8_encode($hello[‘title’]),
    ‘post_content’ => utf8_encode($metadesc.’ ‘.$hello[‘fulltext’]),
    ‘post_date’ => $hello[‘created’],
    'post_author' => '1',
    'post_type'=>'post',
    'post_status' => 'publish',
    'comment_status' => 'open',
    ‘post_name’ => utf8_decode($hello[‘alias’]),
    ));

    post_content is where I need to save the information with my respective tildes.

    But it doesn’t save them, the result is blank, the operation doesn’t return anything, and the apache or php log doesn’t tell me anything.

    the data comes with this collection utf8_general_ci and in wordpress it is in utf8mb4_unicode_520_ci

    Try to do it with Laravel by hand, but it’s the same.

    I can show the information on the web with their respective accents, but I need to save it in the database with accents and others.

    I hope you can give me an idea of ​​what to investigate about it

    Cheers

    • This topic was modified 1 week, 1 day ago by bcworkz. Reason: code format fixed
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The code you posted has many occurrences of “curly” quotes (‘curly’) for string delimiters. You must use “straight” quotes ('straight') to delimit strings in PHP.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.