This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
setup_postdata() and global $post #177
Labels
Type: Question
This is a question regarding the functionality of the plugin.
It seems like
setup_postdata()
does not work correctly if we does not use a global$post
.For instance:
The output will be correct when using this:
The output will be not correct when using this:
Example of using
setup_postdata()
with$post
: https://github.com/WordPress/WordPress/blob/master/wp-content/themes/twentyfourteen/featured-content.php#L23When using
$post
, the displays the following error: "Overriding WordPress globals is prohibited. Found assignment to $post".What would you recommend in this case to avoid the error? Are we allowed to use
setup_postdata()
?The text was updated successfully, but these errors were encountered: