Remove ellipsis from the excerpt retrieved using get_the_excerpt()

The third field in add_filter() is priority. Default WP hook priority is 10. You can omit the 1 altogether, or still declare number of arguments accepting by function by passing it as 4th field. add_filter(‘excerpt_more’, ‘change_excerpt_more’, 10, 1); OR for default: add_filter(‘excerpt_more’, ‘change_excerpt_more’); re: questions in comments still wondering why it wouldn’t work without having … Read more

Get product list of given category

In the end my main problem turned out to be that I was executing code right into functions.php (for testing purpose). The code was executing before woocommerce was initialized and then was failing to fetch products correctly. Despite that, I couldn’t get Wp_Query to return only products of one given category. It was still returning … Read more

Advanced WP Query hogs the SQL server

There are several options: Use some Lucene-based search index and cache your queries there. Power it with lots of RAM so nothing hits your DB after the first query. Use something like… Elasticsearch Solr Sphinx Do not attempt to run Lucene plain … you will find yourself in hell. Nobody does that for a good reason. … Read more

Use meta_query to display events by date in custom field

Simpler CODE: Logically, when you check >= for both _event_start_date and _event_end_date, that automatically covers the BETWEEN check. So the following CODE should work: $termName = get_queried_object()->name; $termSlug = get_queried_object()->slug; $event1 = current_time( ‘Y-m-d’ ); $args = array( ‘post_type’ => ‘event’, ‘event-categories’ => $termSlug, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 10, ‘order’ => ‘ASC’, ‘meta_query’ => … Read more

get complex results set according to category structure

Thinking aloud here… $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘term_id’, ‘terms’ => array( 202, 203 ), ‘include_children’ => 1, ), array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘term_id’, ‘terms’ => array( 100 ), ‘include_children’ => false, ) ), ), ); … Read more