How to use orderby on meta_value when using Pods custom database table storage

As with any custom tables in your database, you can override the SQL that WP_Query ends up using. For this use case, I’d suggest not using WP_Query’s arguments and building your own function to do this instead as it could simplify the logic and complexity. <?php add_filter( ‘posts_clauses’, ‘my_custom_wp_query_posts_clauses’, 10, 2 ); /** * Custom … Read more

SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta

You can do something like Query the wp_posts table Left join the source_name from wp_posmeta table Left join the coverage_url from wp_posmeta table Then select the data you want to pull from post, source_name and coverage_url result Something like this should do SELECT post.ID, post.post_title, sn.meta_value as source_name, cu.meta_value as coverage_url FROM wp_posts as post … Read more

3 queries to update WordPress

Sounds like you’re trying to do it the old and hard way. When you add a fresh install of WordPress, it will ask you for the database information. You would need to create a mySQL database, set a user for that database, and then import the contents from the old database to the new one … Read more

SQL query to check whether a meta key is set or not for a post in post_meta table

Pure SQL questions are off-topic but beyond that, pure SQL is dangerous because it may break if the WordPress Core changes the database structure. You are better off using Core tools where possible. In this case, WP_Query can do what you need. $args = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( array( ‘key’ => ‘status’, … Read more