We're working with Custom Table for a client site where we know that there will be a lot of data. We have successfully migrated from the normal post_meta method by installing the plugin and creating the table. In the admin area all is working well.
Our issue is that posts are created by frontend users and the current code relies on the wp_insert_post to create the post and add the meta data. Using this method the meta data is being stored the WP's post_meta table rather than the new custom table.
Can you let me know how we can get WP to store the meta data in the new custom table please?
For WP_Query, the plugin doesn't integrate with it. You need to perform an extra query to get the posts you want, then use the returned ID to create your own WP_Query.
global $wpdb;
$ids = $wpdb->get_col( "SELECT ID FROM your_table WHERE field1='value1' OR field2='value2'" );
$query = new WP_Query( [
'post_type' => 'post',
'post__in' => $id,
] );