Support

Account

Home Forums General Issues Query post with post object field

Helping

Query post with post object field

  • I have two CPTs
    — Scores
    —- Users

    For the “Scores” post type I have a post object custom Field of “Users” . In the query for “Scores” , I want to retrieve all the rows having “same user”

    Is it possible ?and please help me with this . Thank you so much .

  • Hi Himandev,

    It’s totally possible, the query method depend on the users field type.

    I assume your field type return user by ID. You have to query your score CPT with wp_query and metaqueries.

    If it’s a single post object field allowing only one user : use the wp_query with you field name as key and an equal criteria with the needed user ID.

    If it’s a single post object field allowing multiple user : use the wp_query with you field name as key and and In criteria with the needed user ID.

    If you have your user field in a repeater : I recomand you to follow the John Huebner method

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Query post with post object field’ is closed to new replies.