I'm currently facing a little problem. I'm using ACF plugin which generate complex meta_key names when creating hierarchical fields.

I found in my database meta_key named modules_1_content_0_module.

I want to be able to retrieve all the posts which have a meta_key which finish with _module and where meta_value is a given id.

Is it possible to do that directly with the WP_Query API ?


  • No. You can't do this with WP_Query or Meta_Query.
    – Howdy_McGee
    Commented Jun 17, 2016 at 17:44
  • Argl... The only solution is to rely on plain SQL ?
    – shulard
    Commented Jun 17, 2016 at 17:45
  • You are right, it's a duplicate, I'll close that question, thanks !
    – shulard
    Commented Jun 23, 2016 at 7:58

1 Answer 1


There is an interesting answer on SO which present different methods to resolve that issue: How do I query for posts by partial meta key?

Not the answer you're looking for? Browse other questions tagged or ask your own question.