Skip to main content
added 6 characters in body
Source Link
Rarst
  • 99.9k
  • 10
  • 161
  • 298

A little tunusual Loop structure you have there. get_the_content() works inside the Loop and with global variables set up. And you are not setting up those global variables.

To work with your current code it will be something like:

apply_filters('the_content', $question->post_content);

To make template tags work properly you need to use setup_postdata(), see examples in get_posts() documentation.

A little t Loop structure you have there. get_the_content() works inside the Loop and with global variables set up. And you are not setting up those global variables.

To work with your current code it will be something like:

apply_filters('the_content', $question->post_content);

To make template tags work properly you need to use setup_postdata(), see examples in get_posts() documentation.

A little unusual Loop structure you have there. get_the_content() works inside the Loop and with global variables set up. And you are not setting up those global variables.

To work with your current code it will be something like:

apply_filters('the_content', $question->post_content);

To make template tags work properly you need to use setup_postdata(), see examples in get_posts() documentation.

Source Link
Rarst
  • 99.9k
  • 10
  • 161
  • 298

A little t Loop structure you have there. get_the_content() works inside the Loop and with global variables set up. And you are not setting up those global variables.

To work with your current code it will be something like:

apply_filters('the_content', $question->post_content);

To make template tags work properly you need to use setup_postdata(), see examples in get_posts() documentation.