Search Query that Includes Custom Table

I managed to solve this by taking s_ha_dum’s suggestion to use a UNION. It is as follows: (SELECT ID, post_status, post_title, post_excerpt, post_content FROM wp_posts WHERE ((`post_title` LIKE ‘%diamond%’) OR (`post_excerpt` LIKE ‘%diamond%’) OR (`post_content` LIKE ‘%diamond%’)) AND (`post_status` = ‘publish’ )) UNION (SELECT ref, StoreID, Article, subarticle, description FROM wp_hwproducts WHERE (`article` LIKE ‘%diamond%’) … Read more

Pagination error WordPress multiple loop

I would do something like this: <?php //Protect against arbitrary paged values $paged = ( get_query_var( ‘paged’ ) ) ? absint( get_query_var( ‘paged’ ) ) : 1; $args = array( ‘posts_per_page’ => 6, ‘category_name’ => ‘case-study’, ‘paged’ => $paged, ‘show_all’ => False, ‘prev_next’ => True ); $the_query = new WP_Query( $args ); ?> <?php if … Read more

Slow getting posts from category

My blog has over 700,000 articles… You need to look at your webhost and server. WordPress is perfectly scalable, but you need the hardware to back it up. That’s a database intensive query, and you need the MySQL server to handle it. Run mysqltuner.pl https://github.com/major/MySQLTuner-perl to check your MySQL configurations and adjust cache and memory … Read more

why is this query returning entire blog-posts

The snippet below from the codex suggest that it would just display the first sticky post. If there are none, it wont return anything. Whatever your use case is please apply the logic accordingly. $sticky = get_option( ‘sticky_posts’ ); $args = array( ‘posts_per_page’ => 1, ‘post__in’ => $sticky, ‘ignore_sticky_posts’ => 1 ); $query = new … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)