Mapping the page to a WordPress user is the best approach. An ACF User field to select the user would give you the author ID, which can then be used easily in a WP_Query instance.
WP_Query does not handle this sort of query: use two instances of WP_Query, and then combine the results. Untested code: $posts = new WP_Query( array( ‘post_type’ => ‘post’, ) ); $post_ids = array_column( $posts->posts, ‘ID’ ); $author = new WP_Query( array( ‘post_type’ => ‘any’, ‘author’ => 123, ‘post__not_in’ => $post_ids, // prevent duplicates ) ); … Read more
On the template driving your archive page, you can use the query_posts() function to adjust the main query (WordPress’ default main query, not your custom one). query_posts( array( ‘orderby’ => ‘modified’, ‘order’ => ‘ASC’, ) ); Using the pre_get_posts action is the better method, though slightly more complex (untested, would go in theme’s functions.php or … Read more
Image inside the content is replaced with featured image from my older post
Your query does not determine how many show per row; you’d use CSS to accomplish that.
Adding $query->is_main_query() to your if statement in pre_get_posts function. This will check if it’s the main query for the page, and not a custom query.
You can access another database using the wpdb class and its associated methods. You will need to instantiate a new connection to the other database using the appropriate credentials. Here is the basic code to set up the new connection and query the database: $mydb = new wpdb(‘username’,’password’,’database’,’localhost’); $rows = $mydb->get_results(“<your SQL query here>”); Replace … Read more
How to efficiently find “duplicate” posts, where the titles are different, using metadata to match posts?
pre_get_posts is used to modify the query arguments before the query is run. The $query is passed in by reference, so any changes you make in your function will be reflected in the query that’s actually run. The return that you’re doing will be ignored. I think you might be making your problem worse here: … Read more
How to get posts that have certain meta key value and order based on another meta key’s value