wordpress query – orderby child post date

You should be able to do this with the get_children function (see the codex),

$ticket_id = 34; // assume you want to retried the replies of ticket post id=34
$args = array(
  'post_type' => 'support_tickets',
  'numberposts' => -1,
  'post_parent' => $ticket_id,
  'orderby' => 'date',
  'order' => 'DESC'  );
$replies = get_children( $args );

Assuming that your custom post support_tickets has been registered with the attribute hierarchical set to true (see codex).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)