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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

I'm struggling on a scenario that feels quite simple in theory but might already be hard for me to describe accurately (in English): Basically, there's an external (SQL) data source, let's call it &...
Falcon2014's user avatar
0 votes
2 answers
46 views

I have a website on WordPress, we recently rebranded the website with Avada website builder, but I can't figure out how to get rid of the old links. They have nothing on them, it just says page not ...
Hayley's user avatar
  • 1
0 votes
0 answers
46 views

For example, in a WordPress content has the following text and Div element. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type ...
Geovanny Okuneva's user avatar
1 vote
1 answer
74 views

In my example below, when using fields => ids https://developer.wordpress.org/reference/classes/wp_query/#return-fields-parameter to get an array of post IDs, why does var_dump($args->posts) ...
BlueDogRanch's user avatar
1 vote
1 answer
45 views

I have a custom post type that contains some imported data in a meta field named keywords. For various reasons, there is a requirement where if a user searches ($s) they should get results that match ...
Scribblemacher's user avatar
1 vote
1 answer
59 views

I want to output data from a PostType. This query works: $loop = new WP_Query( array( 'post_type' => 'studio', 'post_status' => 'publish', 'posts_per_page' => -1 , '...
Thomas's user avatar
  • 11
0 votes
2 answers
95 views

The comments left in my code explain what's going on. protected function fetchLocationByTitle($title) { /* * The WP Query class returns wrong post when searching by title using the * ...
user23718181's user avatar
0 votes
2 answers
114 views

I'm using the WP_Query loop to output all categories and their posts into a jQuery accordion, using the category name as the accordion header, with posts from each category inside each accordion. The ...
BlueDogRanch's user avatar
2 votes
3 answers
249 views

I am creating a WP block theme and want to show related posts on the single post page. Using the Query Loop block, I have added a new pattern that displays the latest posts. Now I want to change the ...
Uladzimir Kulesh's user avatar
0 votes
0 answers
43 views

I'm displaying three lists of events on my site: past events, current events, and future events. The lists are sorted by a custom date time field. The code I have is currently working, but Wordpress ...
Sam Sabin's user avatar
  • 101
0 votes
1 answer
54 views

I am trying to sort events (from event-organiser plugin) and posts in a page where posts would be ordered by date and events ordered by eventstart date with a WP_Query by selecting the appropriate ...
made leod's user avatar
0 votes
1 answer
113 views

I'm trying to create a list of related posts from a couple of custom taxonomies and then sort them starting with one taxonomy's terms. The post type is "work" and the two taxonomies are &...
tgerard's user avatar
  • 103
0 votes
1 answer
53 views

I am using a custom template for a members page which looks something like this <?php /** * Template Name: Our Members * * @package Demo */ $args = [ "post_type" => "...
kellymandem's user avatar
0 votes
0 answers
70 views

Example: Treatment - (Term of resource_type Taxonomy) Resource Name 1 (term of resource_name Taxonomy) Resource 1 - Post 1 Resource 1 - Post 2 Resource Name 2 (term of resource_name Taxonomy) ...
Dennis's user avatar
  • 1
0 votes
0 answers
70 views

I'm still learning and have looked at many articles on this site (like this one) and others (my favorite: here), including WP documentation and woocommerce documentation. I'm trying to (a) use a ...
Matthew's user avatar

15 30 50 per page
1
2 3 4 5
384