reference: meta_query with MB Custom Tables
I need to loop (ordered and field-selected) through a custom database with Oxygen page builder.
So there is no other way as to use a meta_query!
You are offering "MB Custom Table" but as far as I understood no way to order such a table with meta_query.
The referenced post is dated Feb 2018.
Your comment was:
"I’m not sure about this, because the way WordPress build SQL queries from meta query object is very complicated. I’ll see if I can do something."
Was there any change within the roughly 2 years?
If no implementation was possible: Is there any workaround on how to implement the first SQL request in a meta_query?
$args = array( 'post_type' => 'square', 'meta_key' => 'sq_text_order', // not meta-value-num, as it is a text field 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'sq_select_squarematrix', 'value' => 'Home', 'compare' => '=' ) ) ) );
The custom table is not associated with the table wp_posts as the wp_postmeta, see more in this documentation https://codex.wordpress.org/Database_Description.
Using the custom table helps us to get the post ID base on the field value. We also note on this case https://docs.metabox.io/extensions/mb-custom-table/#query-posts-with-wp_query.
At this time, the extension does not support to use
meta_query with the custom table. I will discuss this with the developer team and inform you later if there are some ideas.
thanks, I see.
Is it OK to ask in two weeks again?
Please let the ticket open for this period of time.
And only to understand the intention of this extension (sorry if I am dumb or unaware):
Using a separate DB makes a lot of sense, e.g. performance, maintainability, etc.
But what is a typical use case if the retrieved data cannot be ordered or selected by using meta_query?
Maybe I am missing something...
I mean, of course, I can use other frameworks like React, Vue, etc. if I want to have complete control (by doing a lot of coding), but this is a completely different story...