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

learn more… | top users | synonyms

1
vote
1answer
755 views

Display category posts grouped by taxonomy

I'm working on a project where I use the default posts as "Products", default category as "Application" and a custom taxonomy called "Groups". I want to list "Products" by "Application" ...
1
vote
3answers
3k views

$query->query_var['post_type'] not set for pages

Bulding off of this response from @kaiser about being able to filter by post types on a search page, I wanted to be able to automatically add-in all of the public post types available. So, after some ...
1
vote
2answers
2k views

Count user posts by user ID, Post type and Post status

What I am trying to do is modification of this function on codex http://codex.wordpress.org/Function_Reference/count_user_posts Check the title adding post type support bottom of the page. The ...
1
vote
2answers
794 views

Can't pass table to $wpdb->prepare

I'm having trouble passing a table variable to $wpdb->prepare(); Here is functioning code: $table = $wpdb->get_blog_prefix( $blog_id ) . 'my_table'; $voters = ...
0
votes
1answer
25 views

How to print the output of the get_num_queries function from frontend to backend?

I'm trying to develop a simple plugin and figure out how to display the number of queries executed in frontend, to an admin page (plugin options page), using get_num_queries() function. I've added ...
0
votes
2answers
29 views

Include both default and Custom Post Type in query modified inside pre_get_posts

I want to include custom post type in the author arhive page. I tried the method discussed in this post: Including post_type = 'wiki' in author archives add_action( 'pre_get_posts', ...
0
votes
1answer
91 views

Run search query again without pagination gives no results?

Update: This question isn't really relevant anymore. I switched some code, so now the filtering works. Looks like the query wasn't working, because I triggered the indexTaxonomyCounts function from ...
0
votes
1answer
229 views

Run again current query via ajax but changing a var

I have custom query which is $query. The input is based on form input. The query has already run on a page, but after that I'd like to run it again without a page reload, so with AJAX (when the users ...
0
votes
2answers
333 views

When/why does '$query->get( 'tax_query' );' return empty?

First the code: function itsme_better_editions( $query ) { if ( $query->is_category() && $query->is_main_query() ) { $query->set( 'post_type', array( 'post' ) ); ...
0
votes
1answer
168 views

Query set using tax_query with relation 'OR' modifies category object?

(Update: Please see the edits far below.) The code: function itsme_better_editions( $query ) { if ( $query->is_category() && $query->is_main_query() ) { $query->set( ...
0
votes
2answers
44 views

How to display lastest post date in the homepage?

I'm looking forward to display, somewhere in the homepage of a WP site, a legend saying: Last updated: XX/XX by grabbing the date from the most recent post, but not showing any of its content, ...
0
votes
1answer
501 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
232 views

How to display posts from specific category using get_option function?

I try to display posts from specific category only in a author page, using get_option function like in the code below but it does not work: <?php query_posts('cat='.get_option('admin_cat')); ?> ...
0
votes
3answers
151 views

search through post-type attachments titles

I have a page where I show all the attachments of a page in a table which has id=10. I have hundreds of attachments and I would like to implement an AJAX search form that uses the title of attachment ...
0
votes
2answers
1k views

$wpdb returns no results with SELECT query on custom post type, works on default post type

EDIT: Adding more background info. I've coded a plugin that adds a meta box to the post page. When the post is published, the plugin will generate a random ID for the post, and insert the random ID ...
0
votes
0answers
95 views

get_query_var('paged') giving same result

I have a custom page, in that page i am using a custom select query for my search functionality. The problem is pagination not working. I used $on_page= get_query_var('paged'); for pagination. When ...
0
votes
1answer
679 views

Upcoming Event: How do I sort database by custom date field, but ignore past dates?

I am using an events plugin and struggling to get my database query to be perfect. The query is on the event-single.php template. What I need the query to do: Query the "events" custom post type ...
0
votes
2answers
922 views

Using dynamic conditions in 'posts_where' filter

I have the following code which gives be posts that are published in the last 100 days function smbd_cats_by_days ($where = '') { $where .= " AND post_date < '" . date('y-m-d', ...
0
votes
1answer
267 views

show posts only on homepage but using custom post type and taxonomy for query posts via url

I would like to do the following: I have a index.php file in which I query all posts from the existing post_types. Like the code below. <?php if (is_home()); { ?> <?php global ...
0
votes
1answer
208 views

wp remove query

i want to remove a certain query in wp 3.1 add_filter( 'query', 'remove_delete_7_day_draft_queries' ); function remove_delete_7_day_draft_queries( $query ) { global $wpdb; $q = "SELECT ID ...
0
votes
1answer
518 views

How to Check if a Child Category is Being Queried

I need to change the number of posts queried for specific categories 'Recipes' or 'Product Reviews'. The below code works great for this, I have it in functions.php: function ...
0
votes
2answers
363 views

How to extract all ID variables from a query string?

What is the best php method to extract all IDs from a query string and display them in a comma separated list? I have a function that grabs specific posts from the database and am trying to enter ...
0
votes
2answers
262 views

bulk post_content update

I need to replace all post_content in a particular tag/category to the desired one i have. is their a plugin to accomplish it or is their a query to finish this. Iam sick of doing this manually, is ...
0
votes
2answers
989 views

Different Main Navigation per category

I have a client who has the categories listed in the right-hand sidebar. He came to me today requesting a different "navigation" in the header for each category. So basically, if you click on ...
0
votes
1answer
1k views

How to get category/tag in URL for Pagination links?

I have a custom pagination function in functions.php. If I'm at the URL: http://mysite.com/tag/dogs, the Next link currently just contains /page/2. How can I make it so it will look like ...
0
votes
1answer
436 views

Query the Loop without breaking it

Im trying to make different querys in my category like one with a offset of post and one that shows one post but while it continues to go through the loop, this is what i have but the loop keeps ...
-1
votes
1answer
1k views

WP insert post PHP function dynamically generated Custom Fields

Further to my previous question WP insert post PHP function and Custom Fields We have a working insert post function that can also send over custom fields without yet knowing the ID. Please see the ...
-3
votes
2answers
97 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?