Skip to main content

Questions tagged [wp-query]

"wp-query" ambiguously refers to one of two things. 1) WP_Query is a class native to WordPress which allows users to query the posts database using a number of criteria. 2) $wp_query is the global variable that holds the main query object prepared by WordPress based on a given request.

0 votes
0 answers
36 views

get last part of page url and add it as cat in wp_query

I have a page URL : https://mwallpaper.ir/mobile-wallpapers/birds and I grabbed last part of URL with this filter : add_filter( 'example_filter', 'catslug_callback' ); function catslug_callback( $...
ehsan's user avatar
  • 13
2 votes
0 answers
18 views

get_meta_sql hook is not firing

WP_Query uses WP_Meta_Query. I thought this calls the WP_Meta_Query::get_sql() to define the meta query SQL which is where the get_meta_sql filter is applied. I can't get the get_meta_sql filter to ...
Adam's user avatar
  • 103
0 votes
1 answer
23 views

Filter on one post type with taxonimy and get other post type

I would like to fetch my posts of type 'news', 'videos', 'webinars', 'whitepapers', 'testimonials', and 'landing-pages' and apply a "filter" to only get the landing-pages type with the ...
WypSteur's user avatar
0 votes
1 answer
67 views

Passing a variable containing a comma separated list of values in a meta-query

My objective here is to collect a series of values from a custom repeater field into a comma separated list so they can be used in a meta query. The first part of this is operational, and I think ...
mtm's user avatar
  • 43
2 votes
1 answer
23 views

WP_query() Simulate Missing "NOT" relation to Reverse Results?

I have a working and complex "args" ("tax_query") array which returns results. I now wish to get the missing results, this is a "boolean" NOT operation (which "...
Dennis Bareis's user avatar
0 votes
1 answer
84 views

WP_Query for multiple post types just shows one

I have an issue, that I do not really understand. I hope, you can help me. I would like to have a WP_query for multiple post types: $query = array( 'category_name' => $category, 'post_type' =&...
wepli23's user avatar
0 votes
0 answers
22 views

How to display only posts from the last day with posts published?

The goal is to show today's published posts or, if there's none, the last day's with posts published posts. I found this old question, but the code suggested uses query_posts. I'd like to use WP_Query....
Rodrigo G.'s user avatar
1 vote
0 answers
54 views

WP_query with ajax filter not working with input fields

I'm having trouble with my query when using ajax to filter the posts. I have a page where the posts of post type 'activiteiten' are loaded when the start_date custom field has today's date or a date ...
Thessa Verbruggen's user avatar
1 vote
1 answer
47 views

External WP_Query call from PHP crashed after version update

I have an external script that does some DB maintenance through WP_Query and similar functions. It used to work great, but now after a PHP version update (from 7 to 8) it stopped working. The ...
Binyomin's user avatar
  • 113
0 votes
0 answers
34 views

Show the author only own types of publications. (JetEngine, Elementor)

I created a custom post called Locations using Elementor + JetEngine. I also created a User Profile Builder Dashboard with the help of this, where the user (client) can add a location. But the problem ...
user239691's user avatar
1 vote
0 answers
29 views

Include posts with a specific custom taxonomy term in author page

I created a "co_writer" custom taxonomy with author names as terms. I only use this taxonomy to output their names as co-authors on multi-author posts. As such, posts in which an author's ...
Sum's user avatar
  • 11
1 vote
0 answers
26 views

WP_Query - Variable input

Update I think I've completed this, but please clean up if there is a better way. Code is the new working version Original Issue This page template query works & displays the custom posts items ...
Lucas's user avatar
  • 11
0 votes
1 answer
175 views

pretty url for query parametr

I want this link: site.com/c/web/theme/?filter_cms=wp Convert to: site.com/c/web/theme/wp/ I found this code and edited it a bit: add_action('init', function () { add_rewrite_rule('^c/web/theme/([...
Monoor's user avatar
  • 13
1 vote
1 answer
142 views

query loop "inherit query from template" prevents setting sort order

I need all auto-generated category pages to sort oldest-to-newest I'm editing my "All Archives" template in block editor but I'm not having any success it contains a query loop with "...
Displayname71's user avatar
0 votes
0 answers
186 views

Rewrite URL custom search query

I have this url: mydomain.com/?s="SEARCH TERM"&categoria="WORDPRESS CATEGORY OF POSTS"&province="CUSTOM POST FIELD"&poblacion="CUSTOM POST FIELD" ...
Maseres's user avatar

15 30 50 per page