New answers tagged

1 vote
Accepted

How WP determines archive page vs single page?

TL;DR: WordPress uses URL query string variables to select a template based on the Template Hierarchy. Generally, WordPress looks at the URL path, parses it into segments, rewrites the URL using ...
kofeigen's user avatar
  • 281
1 vote

WP Query filtering by custom category not showing all relevant posts

@jacob-peattie answered the question in his comment - I used the wrong key to set the number of posts my query generates. Swapping numberposts with posts_per_page solved the issue. Here's the final ...
Jillian Hoenig's user avatar
0 votes

Why is my nested 'OR' meta_query not working?

So when trying around I haven't gotten any further but maybe this is an even better example. This keeps returning NULL. On top of it all I need to clear all server cache every time because it stores ...
Mart van der Kruis's user avatar
0 votes

Using $paged redirects /page/2 to page 1

I've tried best-noted workaround and it didn't worked for me - using /page-name/?page=2 still redirected me to /page-name/. Also noticed using ?p=2 didn't work either. The only workaround I found is ...
Konrad Gałęzowski's user avatar
0 votes

Why is my nested 'OR' meta_query not working?

Just a couple of minor formatting changes: an extra nested array that can be deleted, and the incorrect 'value' when using the '=' compare operator, and an unnecessary 'relation' parameter. $args['...
YourManDan's user avatar
0 votes
Accepted

Removing filename searches when searching attachments

OK, my colleague has found the solution: add_filter( 'pre_get_posts', function($wp_query) { add_filter( 'wp_allow_query_attachment_by_filename', '__return_false', 999 ); }, 999); Works ...
Biranit Goren's user avatar
0 votes
Accepted

Check for a value in a custom query

After some serious thinking and some trial and error I came up with this solution. Because all data in the query comes from ACF fields I found a way to use the data from these fields to get the result ...
Woohoo's user avatar
  • 1
1 vote

Removing filename searches when searching attachments

Approaching this from the SQL is a mistake, and instead a quick search of the official dev docs for filename reveals a filter named wp_allow_query_attachment_by_filename that is set to true by default:...
Tom J Nowell's user avatar
  • 58.2k
0 votes

Multiple meta value orderby clauses in a WP_Query

Try to name the two arrays you want to use for the orderby. Like this: $args = array( 'meta_key' => 'campaign_end_date', 'orderby' => 'meta_value_num', 'order' => '...
Woohoo's user avatar
  • 1

Top 50 recent answers are included