"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 default object that holds the main query object on each WordPress page.

learn more… | top users | synonyms

0
votes
0answers
27 views

How to format a WP_Query using groupby and orderby meta value

I have a messenger in my app that uses a custom post type to store messages. I have two ways of showing these messages in the front end of the app: conversations and messages. Every message gets 2 ...
1
vote
1answer
384 views

Most popular post for last 7 days

I need to change the most popular post widgets with date restrictions. For an example, how should I get most popular posts(post_views_count) of last 7 days. original query, $popularposts = new ...
3
votes
1answer
49 views

Order terms inside a select dropdown

I'm working on a project where I've a dropdown of all the terms inside a taxonomy. If the user selects a term, then a function is executed. Eveything is working great, but I can't get that dropdown ...
2
votes
1answer
748 views

Reduce or prevent calling of update_meta_cache

My theme calls the update_meta_cache() function 58 times per page! This function appears to run the following query based on the post in question: SELECT post_id, meta_key, meta_value -> FROM ...
1
vote
0answers
44 views

Custom Pagination in Shortcode with WP_Query

Trying to add custom pagination within a visual composer shortcode. The get_next_posts_link() and get_previous_posts_link() functions are working fine, but when I try to add the pagination function, ...
0
votes
1answer
141 views

Query Set Order By Author

I am attempting to orderby the author_name when you click on the Author arrow on a list of tickets. When you click the arrow, the names are ordering by something I cannot identify. I want them to ...
1
vote
2answers
618 views

How to get specific string in explode array?

I have a shortcode where I'm trying to get a specific string from the $args array below. Query: $args = array( //'post_type' => $posttype, 'post_type' => explode( ', ', $posttype ), ); ...
0
votes
0answers
37 views

Sort custom post type by a custom field from another custom post type

I have a custom post type called "listings". When adding/editing the listing, the user can choose enter the ID of a "Plan". I also have a custom post type called "plans" which contains some fields ...
0
votes
1answer
25 views

find posts that don't have a custom taxonomy

I am using a custom taxonomy series to keep track of posts that are in a series. I would like to find the posts that do not have a series. I have the following query: global $wpdb; $pr = $wpdb->...
0
votes
0answers
13 views

how to solve pagination error in category.php file [duplicate]

Now i have four category in my site. i can get all the pages of one category which is tour category and if i click other three i can see first page but if i click to second page it gives page not ...
0
votes
0answers
39 views

How do i get category name dynamically?

I have a page category.php. but i have more category for pages then i want display all the related category pages in category.php page. how can i change category_name dynamically when user click ...
0
votes
1answer
27 views

Query only displays one page_id

I have a short query that is supposed to load IDs from pages that the user picks in the backend. Currently it does display an array with IDs on the frontpage, but it stops displaying posts after the ...
0
votes
1answer
2k views

wp query with multiple taxonomy?

Hello I want to get all the posts that belong to multiple taxonomies. I saw on codex but it is having only static(2) taxonomies but in my case I have variable number of taxonomies. On Codex website ...
1
vote
1answer
559 views

WP_Query not retrieving by random order under parent

I currently have TWO subpages under parent page ID 43. Client testimonials.. Anyway. I have the random order thing in the query $args but the order never changes. What could I be missing? ...
0
votes
0answers
24 views

Using custom query on a custom page for a custom post type

I have setup a custom page (page-mypage.php) and I want to list all posts of a custom post type when I use the loop in my custom page. I'm using pre_get_posts hook to modify the query. Problem: In ...
0
votes
1answer
665 views

All blog posts are not showing up

This post may already exists but I just missed it in how I searched for it. Here goes. I have recently changed my blog back to the Genesis Framework. I am using the Nameless child theme. These are my ...
0
votes
1answer
28 views

Filter by title content and meta key at the same time

Using: $query = new WP_Query(); How do I filter to get records with titles OR content OR meta keys which contain a part of a string. I currently have $args=array( 'order'=>'asc', ...
1
vote
1answer
20 views

Adding an array from a query string to a WP meta_query

I am collecting values from a query string as an array. Then collecting those values and placing them into the value of the 'meta_query'. I am having trouble where nothing gets outputted from the ...
0
votes
0answers
33 views

WP Query with sticky posts and tax_query

I have this query; $posts = new WP_Query(array( 'post_type' => 'post', 'posts_per_page' => 5, )); Which correctly places sticky posts at the beginning. However,...
0
votes
1answer
2k views

Action hook “wp_insert_post” works but not for last imported post

I want to run a custom function whenever posts are imported to my custom post type. I am currently running this code - function on_post_import($post){ global $wpdb; $results = $wpdb->...
1
vote
2answers
531 views

twentyeleven_content_nav hook no longer outputs navigation link after 3.5 upgrade

After upgrading to 3.5, I discovered that navigation has disappeared outside of the main index page. Theme is TwentyEleven and I've verified that this still occurs after disabling all plugins. <?...
-1
votes
2answers
50 views

Filter posts by category

How can I get posts from a specific category on a custom category page? The below code gets the posts from all categories but I can't find a way to filter according to a specific category. Can ...
0
votes
1answer
539 views

Can I make a search query which includes a space?

I want to search via WP_Query for the test "hello " including the last trailing space. Is this possible and if so, how do I do this?
1
vote
3answers
529 views

Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”

I am trying to display 3 post_thumbnails from a custom post type "portfolio" on my homepage template. So one from post 'A' , one from post 'B' and one from post 'C' The image from post A will be set ...
0
votes
3answers
563 views

Remove category from query (show all posts in archive.php) pre_get_posts()

I am using pre_get_posts() to allow all posts to be displayed on any category archive. This is because I will provide a javascript sorting and filtering method using isotope.js. Any category page will ...
0
votes
1answer
31 views

How to exclude a category name from showing?

So I'm trying this code: <?php global $post; $my_query = new WP_Query('showposts=8&category_name=featured'); while ($my_query->have_posts()): $my_query->the_post(); $...
0
votes
0answers
14 views

Display posts in a custom taxonomy, grouped by a different taxonomy

The setup: I have a custom post type called products. I have a custom taxonomy called styles with terms modern, classic, rustic. I have another taxonomy called seasons with terms fall, winter, ...
0
votes
0answers
16 views

Pick date, month or year from publish date to set up Query

I run the query with order by date. it shows something like this. 2016-5-30 : hello world 2016-5-10 : hell world 2016-4-30 : Title A 2016-4-15 : Title B I want to add one option. Can I pick the ...
0
votes
2answers
55 views

How to alter local query, not main query [duplicate]

I've done a wp_query in a shortcode. So, in page xyz I've two wp queries, one is the main query, and other's mine. The SQL query that I got from the query doesn't fit my desired affect. So I need to ...
0
votes
2answers
21 views

Custom WP_QUERY $args

I have an SQL query here: $data_listg = $wpdb->get_results( "SELECT ID FROM " . $wpdb->prefix . "posts where post_type='post' and SUBSTR(" . $wpdb->prefix . "posts.post_title, 1, 1) LIKE '%$...
0
votes
2answers
1k views

WP_Query within function within WP_Query

I have a query which looks like this: $args = arguments for the query $query = new WP_Query($args); while ($query->have_posts()): $query->the_post(); $post_id = get_the_ID(); echo my_function($...
0
votes
2answers
688 views

Custom search: Search posts but display parent page in results

I'm using Wordpress 3.5.1 with a modified twentytwelve theme. My main site structure is based on the Smooth Slider plugin (jQuery Cycle). I have Pages that contain only a shortcode (for example, [...
0
votes
0answers
20 views

Filter with 'OR' relationship between child categories, and 'AND' relationship between parent categories?

I have a some categories set up like so: Age Child Teen Adult Language English Spanish French Relevant code below: $cat = (isset($_GET['cat'])) ? $_GET['cat'] : 0; $args = array( ...
1
vote
1answer
132 views

How to add custom query filters in WP_User_Query

I am creating a list of all users in wordpress. For that I am using WP_User_Query with meta_query so that I can show only filtered users. I am stuck where I want to add a custom query filters in ...
0
votes
1answer
499 views

Creating a navigation menu of all posts of a custom post type and their children posts?

I have a drop down menu that displays a link (the permalink) to all of the posts of a custom post type (county) and would simply like to display their children too this is the code I have so far but ...
0
votes
0answers
24 views

Can't get get_delete_post_link to work correctly

I am using WP_Query to to list all of a certain CPT for each user. Everything is being displayed correctly, but for some reason get_delete_post_link isn't returning anything. Does anyone see what ...
-2
votes
2answers
36 views

show the most recent date of all posts to display on front end

Is there any way to show the date that the last post (most recent) from my custom post type was created? I want to have my site show the last time a list of products was updated and i figured that it ...
0
votes
0answers
31 views

Best way to Order Post in Home without a plugin

We are trying to reorder one section of the home page. our approach was with meta_keys and meta_values WP_Query Sample: <ul id="featuredMain" class="feautrued-main"> <!-- Main ...
3
votes
1answer
48 views

page was loaded over HTTPS, but requested an insecure image

when i install and apply SSL certificate on Bluehost webhosting, indeed my site entering secure channel however discovery page request image with http address but not https address even i upload photo ...
2
votes
0answers
32 views

Number of pages - multiple (custom) post types

My archive query contains a custom posts_per_page, order, orderby, post_type and paged (via wp-pageNavi). array ( 'order' => 'DESC', 'orderby' => 'title', 'paged' => 1, '...
0
votes
0answers
11 views

Query by attachment image size

Is it possible to use WP_Query to get attachment images by pixel size? For example all images with a width of 500px and height of 300px. Or images with a height bigger than 300px. As far as i can ...
1
vote
1answer
4k views

wp_query->max_num_pages always returns 0 on custom post type

Hi there I am developing a theme where I have to load some posts with ajax, in my index page everything works properly, the problem is when I need to use it on custom post type, I pass the values for ...
0
votes
1answer
32 views

Creating Ordered Query using Meta_key

I've hit a massive roadblock that I've been stuck on for days now, hope someone can help with this. The problem: I have a custom field called order_value with the values road, air and bus. I am ...
0
votes
1answer
2k views

How to query posts by meta keys AND under specific category?

The scenary: I'm working in a review system for WordPress, a game review website. It uses default posts, that when under "review" category, shows the review's meta fields (from ACF plugin). It's ...
1
vote
1answer
42 views

How to get posts by multiple post slugs? [duplicate]

i am trying to get posts by multiple posts slugs, i can do this by passing post ids but I do not want to pass post ids i am looking for posts slug Here is my code $option = array( 'posts_per_page' =...
3
votes
1answer
25 views

How to order category.php loop by 'meta_value'?

So I have a basic loop on category.php that displays all posts from the specific category, like this: <?php if (have_posts()) : while(have_posts()): the_post(); ?> <a href="<?php ...
0
votes
1answer
865 views

Custom WP Query from meta_value stored as serialised array

I'm using a Magic Fields 2 multicheck box to store Services which can be assigned to Case Studies. The data is stored as a serialised array in WordPress, and I need some help to extract the "related ...
3
votes
1answer
39 views

Generate a tabbed submenu — from taxonomy term or submenu item — with sample content

I'm looking to generate a tabbed submenu from taxonomy term or submenu item and include sample content (three items per term/submenuu item). The styling I can do, the problem is the html generation. ...
0
votes
1answer
649 views

WP_Query post at custom position

Lets say I have a custom query which based on two custom post types: $wp_query = new WP_Query(array( 'post_type' => array('post-type-1', 'post-type-2'), 'post_status' => '...
0
votes
1answer
2k views

forming WP_Query for posts of all post types but from specific categories

I need to get post from blog, custom post type 1, custom post type 2. custom post type 3 and either from category 1 or category 2 or category 3 or category 4 or category 5 or category 6 or category 7 ...