Tagged Questions

A generic term referring to the process of retrieving information from a database.

learn more… | top users | synonyms

3
votes
1answer
212 views

Using Wordpress public query variables

Good morning. I am trying to query various Wordpress pages, using public query variables, for example http://dmkim1979.ru/?p=37 // single post http://dmkim1979.ru/?page_id=40 ...
1
vote
1answer
38 views

How can I get a list of comments by target

I've been looking at the classes WP_Comment_Query and WP_Meta_Query but to be honest, I can't figure out how to use them together. I want to query the database for comments where wp_posts::post_author ...
0
votes
1answer
659 views

date_query seems to be ignored by wp_query

I'm altering my main wp_query in a pre_get_posts filter in order to improve my site search capabilities. I've successfully achieved searching in taxonomies, but I fail when it comes to the post date ...
0
votes
1answer
165 views

Making certain categories of CPT not publicly queryable

I am developing a custom CMS for a client and one of the Custom Post Types is 'contact', these contacts are organized into categories by a custom taxonomy; my question is whether there is a way to set ...
1
vote
2answers
351 views

Sticky post appears twice

I am trying to modify the number of posts_per_page in the loop. This way: function posts_per_page($query) { $query->query_vars['posts_per_page'] = 3; } add_filter('pre_get_posts', ...
0
votes
1answer
85 views

Exclude taxonomy term from all loops, but having it on widget

I have excluded a custom post type taxonomy term from all posts like this: add_action( 'pre_get_posts', 'exclude_category_posts' ); function exclude_category_posts( $the_query ) { $taxquery = ...
0
votes
1answer
1k views

Select User by Joining Multiple Meta Value Results

( I would ask this in the general stack exchange forum but I think it is more relevant here. I'm intentionally using direct queries to the database here. ) I'm trying to select a group of users that ...
0
votes
1answer
34 views

How to rearrange a pool of posts joined using two queries?

I need to select posts for two different months (current, past). As far as i know, it is not possible to pass m date parameter as an array of integer instead of an integer, so I am performing two ...
0
votes
1answer
128 views

how to limit query_post to first page?

I have a custom post type called listings with different taxanomies, I am using this query to display first only my post that have the type taxonomy featured. This is the code that does that : ...
1
vote
1answer
183 views

How to go about combining dropdowns / filter queries?

I'm coming up short with my googling here. (As 'filter' in wordpress always turns up more content related info). Anyway, my situation is this: I have Categories, Tags, Authors and Archive dropdowns ...
0
votes
1answer
199 views

do_shortcode within post query

I am querying blog posts with a specific category (according to the template page slug, and want each post to output a slider, title and content. I'm using the wordpress plugin Anythingslider for ...
1
vote
1answer
197 views

Attempt to improve WP search, can someone check my SQL query?

I'm stumped. I've done a bunch of work to filter what posts get pulled in a WP search and then even more work sorting those after they're pulled from the DB. My main problem now is getting results ...
0
votes
1answer
210 views

Filter Posts by current Month

Ok, I have a client that wants to only display posts by the current month. I've tried a few different variations but none have worked. Here's where I'm at now. Any help is appreciated! ...
1
vote
1answer
111 views

Transient pagination not working properly

So I wrote the following to create a transient: $wp_object_i_created = new WP_Query('cat=1'); set_transient('category_one_posts', $wp_object_i_created, 60*60*1); Ok so then I decided "Ya know lets ...
3
votes
1answer
202 views

Why does wordpress still strip my query var?

Im trying to pass a query var to a custom page template with pretty permalinks. So basically i have a page called "albums". And i want to pass a query var to that page called "type". So the ...
0
votes
3answers
609 views

Dynamically switch template on click

I have a custom post type setup with a couple custom fields. I am creating a page where I display all of the custom post types, except I want to have multiple views. See the examples below. One is a ...
0
votes
1answer
282 views

Random Category with Recent Post Title and Thumbnail

This code below works perfect to pull the title of five random categories, the issue is for each random category I want the latest post title and thumbnail but where and how do I add the post query? ...
1
vote
1answer
198 views

How to debug a blank page?

I'm not being able to load this page, although I can easily load all other posts that load the same custom post type template (please look for "// From now on, WP is throwing a blank page" on that ...
0
votes
1answer
54 views

Wordpress Query showing multiple titles

I have written a query to display in a jquery slider (nivo) however it appears that it is showing all the posts and not just one at a time This is my code: <div class="slider-wrapper ...
0
votes
4answers
455 views

Query Posts by date range with fixed beginning and end

I need to get posts from a certain timeframe. I am using the posts_where filter. I want to specify a beginning date and an end date. This is the function I use: function filter_where( $where = '' ) ...
1
vote
1answer
190 views

Undefined WP_Query::has_posts()?

This must be wrong. I was testing something so I did: $queried_post = new WP_Query(array('posts_per_page' => 5, 'offset'=> 1, 'category' => 1)); var_dump($queried_post->has_posts()); ...
0
votes
2answers
456 views

Wordpress Find Duplicate Post By Content

Is there any way to find similar/duplicate wordpress posts by post_content. I have tried "Find Duplicates" plugin but it takes a lot of time to search since I have more than 7000 posts in my ...
0
votes
1answer
106 views

custom query to get posts

I want to create custom links like mydomain.com/custom_page/cat=ABC&tag=XYZ So that when a user clicks on the link s/he can see all posts in the category 'ABC' having tag 'XYZ' For this I've ...
3
votes
3answers
275 views

Compare two numeric custom fields

I use Advanced Custom Fields and have a custompost-type "matches". This post-type contains two fields "goals-made" and "goals-against". I want to query wordpress to show only the matches that were ...
0
votes
2answers
488 views

Passing parameters to a static front page

I have googled a lot, but so far haven't come close to a proper solution yet. I need help with passing parameters to the homepage of a WordPress website. Here's my setup / requirements: I use a page ...
0
votes
0answers
18 views

Query posts than have a lapse of time active

First of all, sorry guys for my poor english. OK, i wanna make a query for show posts that doesn´t passed 3 days from it publication. I set a field for the expire date when it´s published (the time is ...
0
votes
3answers
1k views

how to get a different html for odd/even posts?

query posts if posts exist then begin the loop if post is even: <h1>title</h1><p>content</p> if post is odd: <div>its ...
0
votes
1answer
467 views

Why doesn't my WP Meta Query return any results?

Is it not OK to accept a value from $_GET as the key in a WP Meta Query? I'm not sure why this code doesn't return any results... BOTH the queries for Price as well as bedrooms do not return any ...
1
vote
0answers
77 views

Caption and title in img alt tag are the same?

I'm currently on WP 3.6 and noticed an unpredictable behaviour with the alt attributes generated by WP. If I have an image title, the title appears in the alt. If I have a caption, the caption ...
0
votes
1answer
399 views

Can I use WP_Query one time and then filter the results multiple times

I am using the following code 20 times in one page template to query specific data for each section. All of the pages data comes from the same post type, just I need it divided up by a specific custom ...
0
votes
1answer
70 views

Displaying Posts Attached to Custom Taxonomy Terms

The following displays a parent term in a custom taxonomy, then displays the child terms and finally is intended to display the post links (custom posts) for the posts attached to each term. Thus: ...
0
votes
1answer
39 views

how do i register global query in template

ok i think this is a basic php question but here goes: i have this working code: <!-- show the bands playing --> <?php $child_posts = ...
0
votes
1answer
14 views

Custom Query problem access the values

Below is the custom query am running on my wordpress site to get the results from postmeta table. When I var_dump the results then I can see the values correctly but when am trying to access a single ...
0
votes
1answer
313 views

Update Custom Taxonomy Value for a post based on custom date field

Quick read: I need to update the value of a custom taxonomy based on two custom field values (dates) automatically, meaning the post updates itself with having to click "update" to change the value. ...
0
votes
2answers
369 views

custom query for both category and pages using global $wpdb;

I have a custom query returning categories, but I also need to return some pages with a particular post ids. How would I add those? They obviously have no taxonomy and are page post types. Below is ...
0
votes
0answers
143 views

query by meta value then date and not empty meta value

So i have a query like this function filter_where( $where = '' ) { // posts in the last 7 days $where .= " AND post_date > '" . date('Y-m-d', strtotime('-3 ...
0
votes
1answer
129 views

query specific posts according their custom fields, using sql SELECT

My posts have a bunch of custom fields, to help insert and display custom info easily. I am trying to build a search that would select and display posts according values of specific 2 custom fields. ...
0
votes
1answer
33 views

Cannot retrieve home url with custom queries

This is just driving me crazy. I cannot get wp to return the home page/url link. I have tried various combinations of <?php echo esc_url( home_url( '/' ) ) ?> <?php echo esc_url( bloginfo( ...
1
vote
1answer
195 views

How to tune search argument in WP_Query to show only exactly the same results?

Right now I am using this: $args_search = array( 's' => $search, 'post_type' => array( 'post' ) ); $wp_query = new WP_Query( $args_search ); But the problem is that it shows ...
0
votes
0answers
151 views

Filter CPT based on meta box value using Flexible Posts widget?

I'm using the Flexible Posts Widget to display a list of "deals" (a custom post type) in my sidebar. I'm also using that plugin's capacity to use a custom template to control the display of that ...
0
votes
0answers
206 views

Adding a query var to taxonomy term archive - gets redirected to the other taxonomy archive page

I want to pass another query var in the URL through a form while I'm on a taxonomy archive page. The URL would look like so ...
0
votes
1answer
37 views

confirm my booking with phone number

I have created a booking form on front-end, and there is also "confirm my booking" page. once you submit your booking form. and it stored on "booking" custom post and saved post meta (such as phone ...
0
votes
1answer
51 views

Meta_query not filtering posts

I'm trying to filter out 'properties' on a page based on whether they are vacation or long-term rentals. Right now, the results of the following query displays all properties, not just either vacation ...
0
votes
0answers
71 views

Custom Post from Custom Query with Multiple Custom Taxonomy Terms with Pagination

I have a page template like having code, (on the link below) http://pastebin.com/mZaRLKp2 Actually it's the problem of getting custom post list having all the multiple custom taxonomy terms with ...
-3
votes
2answers
108 views

Query parsing only author ids

I need array only all author ids from the loop, each one only once if possible and out of all posts in the loop. Any suggestions?
0
votes
0answers
49 views

Wordpress can only query up to 766

Basically, I am little unaware of my WP can only run a query up to 766 custom post of one type (the actual posts). I have 26,000 posts that are within one custom post type, but cannot query them all ...
0
votes
1answer
507 views

Dynamically generated URL and Content page

I am in need of some advice. I have a section on my home page dynamically pulling in a list of terms from a custom table in the WP db. I have made a unique custom URL for each of these terms based on ...
0
votes
1answer
35 views

Show content if page is a grandchild of top level page

I'm looking to show a certain block of content if the current page is a grandchild of a top level page. This is my current page heirarchy; - Top Level Page - Child Page - Grandchild Page ...
0
votes
1answer
184 views

Set posts per page for parent category and it's all children

I am trying to use the following function to set the number of posts per page for a specific category and all it's children: function hbg_category_query( $query ) { if( $query->is_main_query() ...
0
votes
1answer
31 views

The best way to collision check in WP

E.g. I have a random number generated by a PHP code $random And I need to make a check if this number doesn't exist in any of my posts in DB in my meta field called unique_code What is the ...