list all post who have mutual taxonomy as current taxonomy!

No custom programming answer: A plugin like https://facetwp.com/ will allow you to set up filters as you have described. Custom programming answer: You can create a shortcode that renders fields for the user to check and submit. Then, attach a javascript submit handler to the form so that when the user checks a box or … Read more

Display hierarchical structure of Custom post type in UL LI

The advanced solution is a Walker. But simplest sotution is a recursive function, which will work just like Walker. You can use one below: function wpse343409_get_recursive_posts( $type=”page”, $parent_id = 0 ) { // default parent 0 means only top level posts $posts = new WP_Query( array( ‘post_type’ => $type, ‘posts_per_page’ => -1, ‘post_parent’ => $parent_id, … Read more

Order by value of Custom Field using url string

Try use get_query_var instead of $_GET and also increase priority function my_pre_get_posts( $wp_query ) { // do not modify queries in the admin if( is_admin() ) { return $wp_query; } // allow the url to alter the query if( isset(get_query_var( ‘budget’ )) ) { $wp_query->set(‘meta_key’, ‘budget’); $wp_query->set(‘meta_value’, get_query_var( ‘budget’ )); } // return return $wp_query; … Read more

How to get taxonomy image attached to a Post Type WordPress

use this snippet here i get image which have post id 5 <img src=”https://wordpress.stackexchange.com/questions/344213/<?php echo site_url(); ?>/wp-content/uploads/<?php echo get_post_meta(5,”_wp_attached_file’,true); ?>’ height=”100″ width=”100″> check get_ani_taxonomy_fields($ani->term_id, ‘acf_image_field_name’) this function return post id

How to create better WP_Query to look for date time which is anywhere between two meta values?

You might want to do this for querying between two dates: $query = new WP_Query(array( ‘post_type’ => ‘rezervacija’, ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘start_date’, ‘value’ => current_time(‘Ymd’), //change this according to your need. ‘compare’ => ‘>=’, ), array( ‘key’ => ‘end_date’, ‘value’ => current_time(‘Ymd’), //change … Read more

Getting posts by custom field value

first, you have to loop through all posts that have this meta key (your custom field) and then update post meta with replacing the word (from) to leave the number alone in the meta value. //paste the following code in your plugin or theme functions.php add_action( ‘init’, function () { if ( ! get_option( ‘prefix_correct_data’ … Read more

One of two similar WP Query is very slow

It is likely there are very few rows WHERE AND ( wp_posts.post_date >= ‘2019-09-04 21:45:00’ ) there are likely many thousands of rows WHERE AND ( wp_posts.post_date < ‘2019-09-04 21:45:00’ ) and a table scan is required. EXPLAIN SELECT SQL_NO_CACHE remainder of query for each and examine results carefully. Post the TEXT RESULTS of EACH … Read more