Is it possible to use WP Query to orderby custom meta value and custom taxonomy?

I have the similar query in my blog. This my args array : $args= array( ‘post_type’ => ‘box’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘position’, ‘order’ => ‘DESC’, ‘orderby’ => ‘meta_value_num’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘taxonomyname’, ‘field’ => ‘slug’, ‘terms’ => ‘yourterm’ ) ) ); Hope it will help you

In list with recent coments – only show one comment per page/post (latest comment)

First you should KNOW all different posts with comments: global $wpdb; $SelectSQL = “SELECT DISTINCT `comment_post_ID` FROM {$wpdb->comments} LIMIT 0, 15”; $Rows = $wpdb->get_results($SelectSQL); then for each of these posts get the latest comment: foreach($Rows as $row): $comment = get_comments(array(‘post_id’=>$row->comment_post_ID, ‘number’=>1, ‘status’=>’appprove’)); $comment = $comment[0]; … and continue with the display of comment, hope you … Read more

Incorrect data after modifying post using backlink from wp_die

I don’t know why this issue occurs. The back_link is created in /wp-includes/functions.php. If there were a Javascript solution, it could be applied in the message of wp_die. For example: $msg = ‘Error’ . “\n<p><a href=”https://wordpress.stackexchange.com/questions/80375/javascript:history.go(-1)”>$back_text</a></p>”; wp_die($msg, ‘Error’, array( ‘response’ => 500 )); But this didn’t work… What I saw is that the Title and … Read more

Register a title automatically with a relationship field

If you can grab your data early enough you can do this: function alter_title($t) { return ‘altered-title’; } add_filter(‘pre_post_title’,’alter_title’); add_filter(‘pre_post_name’,’alter_title’); That will change the title and the slug before the post is saved. Of course, you need to work out some logic for that function. As is, it changes all post/page/CPT names and slugs on … Read more

Posting to loop.php file

If that is the sum total of your loop.php, and you are accessing it directly which you are, your biggest problem is that you aren’t going to have access to any WordPress functions and yet you are trying to use WordPress functions. You are going to get fatal errors. Your script does nothing to boot … Read more