Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #46671, comment 7


Ignore:
Timestamp:
04/16/2020 08:46:36 AM (6 years ago)
Author:
tofandel
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #46671, comment 7

    initial v1  
    1 @markparnell You should add a call to
    2 {{{
    3 setup_postdata($parent)
     1@markparnell You should probably set the WP Query's post variable to the $parent
     2
     3{{{#!php
     4<?php
     5global $wp_query;
     6
     7$wp_query->posts = [$parent];
     8$wp_query->post = $parent;
     9setup_postdata($parent);
    410}}}
    511
    612to avoid breaking existing code and solve the issue with wp_reset_postdata not doing anything
     13
     14
     15(Though it feels hackish by lack of other way to do this)