Improve performance of slow query
Improve performance of slow query
Improve performance of slow query
I have checked at the source code and found $_GET as a solution to target them. $type = isset($_GET[“type”]) ? $_GET[“type”] : ‘story’; if( is_page(‘post-create-page’) && $type==’story’ ) { ….} elseif ( is_page(‘post-create-page’) && $type==’openlist’ ) {…..}
Sort query_terms_list for post_tags alphabetically
Try use meta_value instead of meta_value_num. $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 20, ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘pa_review_date’, );
Pagination not working on custom post types with rewrite slug
You can using get_posts(). $pages_args = array( ‘orderby’ => ‘menu_order’, ‘parent’ => 0, ‘post_type’ => ‘guideline’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘no-visit’, ‘meta_value’ => ‘true’ ); $pages = get_posts($pages_args); $pages_args = array( ‘orderby’ => ‘menu_order’, ‘parent’ => 0, ‘post_type’ => ‘guideline’, ‘post_status’ => ‘publish’, ‘meta_query’ => array( array( ‘key’ => ‘no-visit’, ‘value’ => ‘true’, ‘compare’ … Read more
Rewrite rule for query params
You need to use WordPress meta query: Display posts where the custom field key is ‘extra1’ and the custom field value is ‘test’: $query = new WP_Query( array( ‘meta_key’ => ‘extra1’, ‘meta_value’ => ‘test’ ) ); For more info take a look at WP Query Custom_Field_Parameters.
try adding: ‘meta_key’ => ‘start_date’
A much simpler method to bypass these issues is using WP_Query: $popularQuery = array(‘orderby’ => ‘comment_count’, ‘posts_per_page’ => ‘-1’, ‘author’ => 1); $popularPosts = new WP_Query($popularQuery); while($popularPosts->have_posts()) : $popularPosts->the_post(); ?> <tr> <td><a href=”https://wordpress.stackexchange.com/questions/23820/<?php the_permalink(); ?>”><?php the_title(); ?></a></td> <td><?php the_author(); ?></td> <td><?php the_time(‘j M Y h:i A’) ?></td> <td><?php comments_number(); ?></td> </tr> <?php endwhile; Also note … Read more