Strange: can't put post content into an (PHP) array
-
Long story short: I have a script that fills an array with post-data, json encodes it and passes it to an external source. This way; it can import my WordPress posts into a different CMS. (You don’t want to know why.)
All is well, but I’ve noticed your plugin breaks my script. And I can’t seem to find out exactly why. Perhaps you can give me any clues?
$pc contains the post content, via $pc = $post->post_content;, so it’s the full HTML.
Nothing wrong there. Only when I want to assign it to a key in an array, it breaks.This doesn’t work:
$altdata = array( "status" => '1', "copyright" => '', "content" => $pc, "author" => $pa, "meta" => '', "media" => $imgs, "id" => $id, );
This does: (mind the absence of the content)
$altdata = array( "status" => '1', "copyright" => '', "author" => $pa, "meta" => '', "media" => $imgs, "id" => $id, );
I can even save the data in my $pc variable to a file, or do other stuff with it. It’s just this part that doen’t work.
- The topic ‘Strange: can't put post content into an (PHP) array’ is closed to new replies.