TCPDF get_post_meta outside the loop

I’ve got it fixed:
I needed to add the wp-load file that contains all the WP-functions

include('../../../../../wp-load.php');
global $post;
$id = $_GET['id'];
$content_post = get_post($id);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);

Now the content loads in the PDF

Leave a Comment