clean up the global variables when moving out of the loop
|Reported by:||aldolat||Owned by:|
On a theme, that I am developing, the sidebar has a new WP_Query to get only one post from a specific category. All works well (index, single, archive, pages) displaying correctly the result of the_content() of the main column (the main query) and the result of the_content() of my custom query in the sidebar.
The problem is that only on pages and articles that have pagination (using the <!--nextpage--> construct), the function "the_content()" of the sidebar displays the same content of the main column on pages 2, 3, 4 (and so on) of those pages/articles, while on page 1 the various contents are displayed properly.
Is it a bug?
As MichaelH reported, using "echo $post->post_content;" fixes the issue temporarily.
Change History (20)
comment:2 Viper007Bond — 5 years ago
- Keywords reporter-feedback added; sidebar the_content removed
- Milestone changed from 2.8 to Unassigned
- Keywords needs-patch added
- Milestone changed from Unassigned to Future Release
- Type changed from defect (bug) to enhancement
- Keywords reporter-feedback removed
- Summary changed from Use of the_content() in sidebar to clean up the global variables when moving out of the loop
- Component changed from General to Query
- Keywords has-patch needs-testing added; needs-patch removed