Randomizing WordPress Custom Post Type Sorting Through Them Without Page Refresh
Randomizing WordPress Custom Post Type Sorting Through Them Without Page Refresh
Randomizing WordPress Custom Post Type Sorting Through Them Without Page Refresh
Multiple meta_query not returning rows
wc_get_products() return empty object
Firstly i added table postmeta to query function add_join_clause_to_view_sql( $join, $wpq ) { global $wpdb; if( $wpq->query[‘orderby’] === ‘price’ || $wpq->query[‘orderby’] === ‘price-desc’) { $post_meta_table_name = $wpdb->postmeta; $post_table_name = $wpdb->posts; $join .= ” LEFT JOIN $post_meta_table_name ON $post_meta_table_name.post_id = $post_table_name.id “; } return $join; } add_filter(‘posts_join’, ‘add_join_clause_to_view_sql’, 10, 2); Secondly i added meta_key in WHERE … Read more
Directly using WP_Query, I don’t think this is possible as you would require some logic inside the WP_Query which allowed you to say ‘if primary_geo is set to NJ then look in NJ, or if it’s set to PA then look in PA’. However, what you could do is use a hook to update a … Read more
Plugin’s company proposed a solution to go with the wpdb object and write manually the queries… Kudos to @Sally CJ. You were right in you theory, as the taxonomies are not yet known (or registered) when the script is executed. I will go with this approach for now, as time is limited, but will try … Read more
Generally, no, there is not a good way to achieve this if the sort order doesn’t produce things automatically in the order you need them. This is because WP_Query doesn’t allow for insertion of logic to say ‘order by fieldX except if $some_condition’ Somewhere, you’re going to have to write the logic for the order … Read more
Query on a repeater date (acf)
No you can’t pass a callback function. Callback functions are PHP, so they can’t be run in MySQL. For that to work it would need to query the results from the database first, but you’d get the wrong results because they’re unsorted. You would need to use the posts_orderby filter to do this as part … Read more
No, it’s not possible. You can’t actually store arrays as meta. When they’re saved they’re converted to a string, so there aren’t individual parts that you can sort by. To do this you will need to store the share numbers as their own keys.