There’s nothing wrong with it from WPs point of view. If you want to join posts with your own table and change the way of ordering, then that’s the way to do it.
The only thing is a little bit tricky, I guess, is that you use posts_join_paged
and not posts_join
– it can make it a little bit harder to debug if something goes wrong, but it also makes it a little bit more optimal, so there’s nothing wrong with this.
The are two things that concern me a little bit with this approach:
- Will that result in a proper order if there is no row in your custom table for some posts?
- Wouldn’t it be nicer for DB to store that multiplication result already computed – ordering by value of o column is nicer for DB than ordering by computed value.
Related Posts:
- Return only Count from a wp_query request?
- Use REGEXP in WP_Query meta_query key
- find a random blogid across my multisite network that has at least one post published
- Get posts by menu ID
- Slow SQL_CALC_FOUND_ROWS Query
- Should close $wpdb via $wpdb->close()
- Get the Plugin Which Triggered a MySql Query in WordPress?
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Mysql query LIKE not working
- wpdb custom post_type problem
- why update and delete query not worked in custom table?
- How to implement a new row_count method in WordPress?
- wp_Qwery works to slow
- Query most popular terms by taxonomy over 2 week period
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- How to access custom WordPress database tables
- List of ways to access WordPress database?
- Specify strict ‘order by’ in WordPress query
- how to get Nearby zipcode
- Does WordPress have something like Drupal’s DB API?
- WP_Query with page_ids in arguments without a result
- get_var is neither a string, integer, or array …?
- Why last row deleted when refresh page
- How to get user avatar via WPDB
- Fix wp_term_relationships slow query in get_posts
- Sorting query_posts() with a complex orderby filter
- Track write actions to the database
- Include post_status check within $wpdb query
- wpdb get_results() returns only 2 rows
- WP_Query always returning the last custom post
- Optimising amount of calls to custom fields
- Different sql queries count indicator on the main page [closed]
- SQL query into to WP query
- Query with search and subscribers only output
- Create table from array with prepare
- querying data via $wpdb and get_row
- Applying posts_clauses filter to specific queries only
- Add class to first post in custom loop using post_class filter
- Show all data in database table and make it into an interactive table
- WP_Query with different postmeta filter for each categories
- Wp query show post by author name or post title or post content
- inserting a post from an extern php file but post content doesn’t show on wp site
- Slow WP_Query with ‘OR’ on meta_query
- No results found from a $wpdb->get_results() query when trying to join more than one meta key query
- Add posts to WP Query object
- How to query custom post types with mixed AND & OR statements for custom fields
- WordPress running SQL query to update database from form
- database query with more than a couple meta hangs and doesn’t complete
- wp_posts table: safely remove unused columns to save database storage
- How to alter local query, not main query [duplicate]
- How to filter a query by date in a shortcode?
- How can I allow sticky posts but cap the query to 1 post?
- how to access query string in wordpress?
- Custom query: Get all posts that are from a certain category?
- How to pass orderby params to $wpdb->prepare()?
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- Have working sql query… trying to adjust it to use $wpdb
- Ajax future single post query doesn’t work when NOT logged in
- Conditional sorting with variable using WP Query
- Is it safe to access the underlying mysqli object from \wpdb for custom queries?
- how update data through ajax and jquery
- Filter Custom Taxonomy Posts
- Is it possible to query from external database? [duplicate]
- Meta Query doesn’t works as espected
- Include posts from some categories while excluding from others
- WP User Query with Custom Fields and Search Results
- Make a SQL query with wpdb in WordPress
- How to retrieve the data from the sever and displaying it in a page?
- Changing the default wp_search_stopwords
- WordPress query posts with multiple post_meta data
- Custom WordPress Table wpdb
- Filter post query to only show direct children of category
- Best practice to limit results in get_row()?
- Is it possible to add an argument to a custom function added to a filter hook?
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- How to set up hierarchical relationships without using plugins / meta query
- How I can change the condition or compare operator for WP_Query in pre_get_posts
- get_post() is not returning correct value
- Change AJAX filter from POST to GET for URL Parameters
- Using Transients
- Using post_where filter only on main query NOT sidebard new WP_Query
- Filtering posts by archive showing all years
- I can’t update my data through $wpdb
- Trouble running $wpdb->query() with last_insert_id
- WP_Query – How to get all posts of specific days of week by custom field date?
- Update query for wp_posts and wp_postmeta
- Slow Query On Search
- Query Column of Specific ID from Database Table
- how to write wordpress query for multiple metakeys checking?
- Wpdb->query result show 1 but is not an integer
- Multiple wp_query on archive page
- Retrieve select tag custom values from array and display them in current page with wp_query?
- How to use a dropdown to filter posts by custom field
- Why having more than 10 clauses in WP_Query results in some outputs being dropped?
- mysql query order by
- How to create more than one new wpdb object?
- Storing an array of objects related to each user
- Remove post type filter added by the plugin in the final query
- Retrieve data from wordpress db via input and put those result in dropdown
- WP Query – filtering terms with regex