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.
5,753
questions
1
vote
1
answer
39
views
How to create a three column blog layout with a single query and with three different classes?
I am trying to achieve the following layout :
I have created a shortcode for this but I am not getting the desired result. Can anyone guide me where I am getting it wrong. Here is full shortcode. ...
0
votes
1
answer
19
views
Adding a language rule and displaying posts with a custom taxonomy term on its archive page
The WordPress website I'm working on is available in two languages using Polylang, en-US and en-PH. I use CPT UI and have a custom taxonomy "subtopic" that is not multilingual. Under "...
0
votes
0
answers
20
views
meta_query post_date not returning results
I'm working on a query where I have a few conditions, one of them involving post_date. However, whenever I try to write my query, post_date doesn't return any matches. If I comment that part out, it ...
0
votes
0
answers
11
views
Use custom url params with value from a custom field to return the post containing the field value
I got a list of links from an external api, that I want to associate with wordpress posts. The api links are distinguishable by an id. In each Wordpress post, there is a custom field where this id is ...
0
votes
0
answers
42
views
"Page not found" while on page 2 from pagination menu
all. I'm getting a "Page not found" message in my firefox tab when I click page 2 in my pagination menu. What's odd is, the content shows up just fine on all paginated pages. I've tried ...
0
votes
1
answer
37
views
What is the easiest way to create a custom field archive?
So, here is the issue:
I am using a plugin named User Submitted Posts, and it works great on its part. However, I still want to have that user content page the Twenty Twenty Four theme has by default, ...
0
votes
1
answer
22
views
WP Query: orderby with one meta key, but multiple values
I'm trying to order a wp_query using one custom field. It is a radio group with three values: G, S and B (These represent Gold, Silver and Basic). I've been following the documentation and have looked ...
0
votes
0
answers
20
views
Show post in elementor based on views and specific category with query id feature in elementor
I have two functions for query filter:
function my_query_filter_most_views( $query ) {
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'meta_key', 'entry_views' );
$...
0
votes
1
answer
21
views
Not displaying the wp_query object for the following code in the frontend
add_action('template_redirect', function () {
global $wp_query;
echo '<pre>';
print_r($wp_query);
echo '</pre>';
die;
});
0
votes
0
answers
20
views
Filtering custom post type list in admin by custom meta key/value
I am trying to add an additional filter to be able to filter by a custom meta value but it is not returning any values when I would expect it to.
Here is my code to add the filter dropdown (this seems ...
0
votes
0
answers
37
views
Why WP_Query with the same arguments retrieves different results?
wp_reset_query();
wp_reset_postdata();
$post = null;
$course_args = array(
'post_status' => 'publish',
'post_type' => 'course',
'posts_per_page' => 5,
'order' => '...
0
votes
0
answers
15
views
WP_Query on custom taxonomy -> Location and Activity
A store location site displays stores based on region, town OR activity.
I am using the WP Store Locator plugin and also using Divi Builder to create the pages.
This is proving quite powerful and I ...
0
votes
1
answer
28
views
Orderby meta _value that is saved as an array
I want to order a WP_User_Query by a meta value. The meta key is a multi-select field, and the value is saved as an array.
When I do a print_r of get_user_meta($user_id,'committee',true) this is what ...
0
votes
2
answers
49
views
How to use meta_query to retrieve posts from multiple custom post type
I am having two custom post type "meet_our_community" and "news"
I have added a checkbox field named 'add_to_meet_our_community' from the acf to 'news' post type.
Now I when tried ...
0
votes
1
answer
21
views
WP-Query and Searching Inside Arrays
I have a plugin that stories a grid of integers in meta fields like so:
'pricing_info' =>
array (
0 => '1 | 1 | 1',
1 => '1.5 | 1.5 | 1.5',
2 => '22 | 22 | 22',
),
So its ...