wp query – Orderby related post object

Question

Is there a way to orderby query by meta_value from another custom post related to the first one ?

Like :

$related_post = get_post($related_post_id);

$args = array(
    'post_type'  => 'my_custom_post_type',
    'meta_key'   => $related_post->name,
    'orderby'    => 'meta_value',
    'order'      => 'ASC',
);

Any help would be grateful.

0
FloJDM 4 weeks 2021-11-04T03:46:20-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse