Support

Account

Home Forums Front-end Issues Query posts by user relationship field Reply To: Query posts by user relationship field

  • I missed your question about 'meta_value' => ':' . $post_ID . ';'

    But I did look at this. Looking back to your data in the database, meta ID 5823 that meta query for post ID of 1 would match i:1;s:3:"857";. To be honest I can’t say how much this will affect things. I have with post IDs in the 6 digit range. In this case I’d only be safe looking for posts ID > 6.

    I also have clients with > 20 posts in a relationship field so I would only be safe if the post ID is greater than 20 or 30 or it would match the a:22 portion of the serialized array. You could potentially limit this by using I missed your question about 'meta_value' => 'i:' . $post_ID . ';' but that would not eliminate matching array indexes that match post ID values.

    I have never liked serialized data as a storage mechanism, but that’s WP.