Make WordPress Core

Opened 2 years ago

#55287 new feature request

Allow for DISTINCT in WP_Query method

Reported by: simbaclaws's profile simbaclaws Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.0
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:


Dear wordpress developers,

Currently I'm working with a plugin to create designs.
This plugin has an element called a repeater element that basically makes use of the core WP_Query method in order to fetch custom post types or normal post types.

However, since I'm using this page builder or theme builder, I am in no way capable of using DISTINCT within the filter
Because this requires me to send the WP_Query instance, which is basically only used within the repeater element and can not be set to a variable in this particular case.

This means I'll have to rebuild everything through code, instead of being able to use my page or theme builder.

Now I get the idea of saying this is a bug with the page or theme builder plugin.
But in fact, what I want to know is why are we using a filter to create a DISTINCT query inside of WP_Query? Isn't it possible to implement this inside of the WP_Query arguments instead? I basically want to say: fetch posts with unique titles. This seems much more logical as the SQL query is build from WP_Query...

I've already looked through the entire codex, and couldn't find any possible parameter that could be used for this...

My question to you is: Can this please be added to wordpress core?
I find it highly frustrating that WP_Query doesn't have this sort of capabilities out of the box.

Change History (0)

Note: See TracTickets for help on using tickets.