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

learn more… | top users | synonyms

0
votes
1answer
16 views

Wordpress Insert not working with ajax

I am trying to enter insert data with form in wordpress and want to use ajax for that. Without ajax it works fine but when I use ajax pressing the submit button gives 0 in result and the data is not ...
0
votes
0answers
16 views

Query posts by date - category and custom field

I have this scenario: Categories: 23Feb2015, 24Feb2015, 25Feb2015, 26Feb2015......30Jan2099 Every day i add 5-6 posts in to a different category (today posts are in category 26Feb2015, yesterday ...
0
votes
0answers
37 views

SQL query equivalent to WP User Query

I have the following WP user query code: //Get all users sorted by whatever $sorted_users = new WP_User_Query(array( 'orderby' => 'meta_value', 'meta_key' => 'satisfaction_rating', ...
0
votes
1answer
16 views

WP_User_Query orderby meta_val_num

I know that normal WP_Query's can have an "orderby" parameter of "meta_value_num", but when I try to user "orderby" => "meta_value_num" on a WP_User_Query, it doesn't seem to work. Anyway I can ...
0
votes
1answer
22 views

Query posts using meta_key

I am trying to rank results based on the value of a meta_key. This is my form <form action="<?php echo home_url('/');?>" method="get" data-javo-patch-form-for-result> <input ...
0
votes
1answer
9 views

show posts found in multiple categories via category_name query string?

I am attempting to allow visitors to filter posts in an archive to show posts that are found in two categories. The code is building the URL as follows: domain/?category_name=slug1+slug2 Previously, ...
0
votes
0answers
18 views

Ajax Form data is not posted back to the get_results()

I am trying to run a wordpress wpdb->get_results select query and I want to get the search criteria from a textbox. I want to do it form and with ajax without refreshing the page. No matter what I do ...
0
votes
1answer
23 views

Ajax Query returns zero

I am doing simple wordpress select query and want to do this with ajax jquery and do not want the page to refresh when I press search button and writing text in search textbox. As soon as I press ...
0
votes
0answers
10 views

$wpdb->get_var returns nothing,

I don't see any errors, but there is no output from: global $wpdb; $tablename = $wpdb->prefix.'postmeta'; $field = "wpcf-image-".$imgnum."-after"; $id = 1910; $single_result = ...
0
votes
1answer
27 views

Get all user meta by meta key instead of ID

I'm trying to compare user meta values to find highest and lowest values. I have a user meta value set up called "hourly_rate". I want to get the hourly rate for all users and then run PHP's min() and ...
-1
votes
0answers
7 views

How do i get the total sales from a specific period? [closed]

I am using the WPSC plugin and i like to get some custom data. I like to know the total sales in quantity of a specific product for a specific period. This i how i get the total So how can i select ...
2
votes
2answers
106 views

get_the_foo() in the loop - does it perform another query?

I'm unclear on the get_the_foo() style of functions, for example get_the_permalink(). My main question is: when this is performed in The Loop, is another SQL query executed (besides the original ...
0
votes
0answers
20 views

Conditional filter for a wordpress query [closed]

I have a condition to add a filter inside my wordpress query. My code is next: $args = array( 'posts_per_page' => $number, 'meta_key' => 'MYKEY', 'orderby' => 'meta_value_num', ...
0
votes
2answers
41 views

$wpdb->query can't insert data

I Write Code to Save data in the Wordpress database table (table name is wp_fafa) But Can't Save data in $qry = $wpdb->query( "INSERT INTO `wp_fafa` ...
0
votes
0answers
18 views

Using $wpdb (WPDB class) 'replace' with multiple WHERE criteria problem

I have two fields that are used to identify a particular row (acting as a composite key). If it does not exist, I wish to insert a new row. The REPLACE function ...
1
vote
2answers
18 views

Query posts if meta key starts with

I need to find posts with a meta key that starts with the current year + the current month (i.e. 201502), but the actual value could also contain any day within that month (i.e. 20150214). The ...
0
votes
0answers
21 views

Pagination not working in custom post page

I have this theme that I created which is a mix of code copied and mixed from different themes, and I have a custom post page in the theme where pagination isn't working for some reason. <div ...
0
votes
1answer
17 views

You have an error in your SQL syntax - Help with query

I have a programmer that developed a custom plug in for a client's website and after moving the site to client's server, some parts are not working. Looking at the error log, there is an issue with ...
0
votes
1answer
42 views

3 Posts in Loop, Show Stickies First

Okay I am starting to wonder if it is even possible to do this! As I've found very little info on the matter online. This is a fresh WP install that I've been experimenting on so that I can work in a ...
0
votes
0answers
29 views

wp_query - Modify $query to include duplicate content

I'm setting some featured content through the customizer (it's saved in theme_mod); Using the pre_get_posts hook, I'm retireving the feature pages in this way: ...
3
votes
2answers
94 views

Return only Count from a wp_query request?

Is it possible with the standard build-in tools in Wordpress to get wp_query to only return the count of an query? Right now, I’ve a query which has several meta_queries but what the only thing I’m ...
0
votes
1answer
19 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 ...
0
votes
1answer
93 views

WooCommerce search products between price range using WP_Query

I am currently building my own custom advanced search functionality for a WordPress website with Woocommerce. You should be able to search using: Category Min/Max price My current progress is ...
0
votes
1answer
51 views

WP_Query custom order and pagination

I am seeing some strange behaviour when combining a custom order with pagination when using WP_Query. The arguments for my query are as follows: $args = array( 'post_type' => 'news', ...
0
votes
2answers
26 views

Make a WP Query search match exactly the search term

I'm using WP Query and the results coming back when using the search term aren't working as I wish. For example searching for 'art' returns also results for words containing 'art' such as 'part'. How ...
-1
votes
1answer
20 views

query grandchildren taxonomy terms

I have a function that queries the children of each taxonomy terms, I'd also like to query the children of these children terms too, my markup is as follows: <?php $terms = ...
0
votes
0answers
15 views

how to create advanced search [duplicate]

I'm really stuck in this and i cant find any tutorial or article about this topic. How about if we have this pattern for search: [country] AND [category1 OR category2] AND [city1 OR city2] AND ...
1
vote
1answer
19 views

How to add a post or page tag to the list of classes appearing in the body tag's class attribute?

Good day, Perhaps you are willing to help out a php-beginner. I'm trying to add a post or page tag to the list of classes appearing in the body tag's class attribute. These classes are printed onto ...
2
votes
1answer
33 views

How to do a query on custom taxonomies that is uncategorised?

I have a custom taxonomy and I wish to do a query for all custom posts who has no value assigned for that taxonomy (i.e. uncategorised). This is what I have so far: $uncatQuery = new WP_Query( ...
0
votes
0answers
6 views

Partial text search custom taxonomy

I am trying to do an autocomplete field that interrogates the database finding a custom taxonomy but can't seems to figure out how to achieve this. Would i need a custom query?
2
votes
2answers
29 views

$args numberposts variable

$args = array( 'numberposts' => '10', 'post_type' => 'newposttype'); $recent_posts = wp_get_recent_posts( $args ); I know it's not a simple thing to ask but how could I set the numberposts ...
0
votes
1answer
34 views

Using WP_Query to re-query and sort results using a date?

I'm writing a function to find the users next upcoming event (stored as CPT), chronologically. If I use a normal query and do something like 'post_type' => 'ticket', // another CPT set up to act ...
0
votes
1answer
20 views

How to get to a specific position in wp_query?

Background: I'm trying to display images in a slideshow, and I want to select those pictures randomly from the website's media. The image has a custom field in order to be selected for being the ...
0
votes
0answers
23 views

Wordpress search query

I used code snippet, from the plugin http://wpadvancedsearch.com/, which works very well, but when I press a search button, it generates the following string in the URL: /?search_query=& and I ...
0
votes
0answers
18 views

Optimising specific Query with ACF meta objects

Is there any way I can improve the following query without touching the server, as it's taking around 5-6 seconds to execute, the SQL is outputing as: SELECT wp_posts.* FROM wp_posts INNER JOIN ...
0
votes
0answers
13 views

custom post types not appearing in Search multiple post types

I have a Search page where users can select to search for multiple post types: posts, pages, docs, newsletter. What is driving me nuts is that: a) Users can select posts/pages OR docs OR ...
0
votes
1answer
48 views

i'm trying to get all my media query attachments via ajax in wordpress

i'm trying to load all my media files via ajax: $.ajax({ url: '/wp-admin/admin-ajax.php', type: 'post', data: { 'action': 'query-attachments', 'post_id': 0, ...
0
votes
1answer
25 views

Display the latest post from some selected authors

I'm building a slider that will display the latest post of a few selected authors. So far, I've written this: <?php $args = array( 'post_type' => 'post', 'posts_per_page' ...
0
votes
0answers
27 views

How do I get a nested query to only display content that the main query outputed

I have a CPT 'artists' and a CPT 'events' I want the 'artists' to query first based off the posts tag and then I want the 'events' to query events based off what 'artists' was queried. Heres what I ...
0
votes
2answers
47 views

get_posts showing only 5 posts. (nopaging and posts_per_page -1 not working)

I have this piece of code which works but it's showing only 5 posts (with custom taxonomy) where should be 7. If I hit the tag url, it shows the 7 registries, so the problem it's in this code and its ...
0
votes
0answers
35 views

MYSQL sleep process for 20 seconds while site is “waiting for…”

I'm running WP 4.0.1 on an Ubuntu VM server. The server has no outside internet connection, so I have enabled define('WP_HTTP_BLOCK_EXTERNAL', true); in wp-config.php. When I click a link on the ...
0
votes
1answer
33 views

How to detect if query is runned from widget?

I want to know if exists function that detect if some database query run from widget, for example from recent_posts widget or search_widget.
1
vote
3answers
49 views

How to display all posts with today's same month and day only?

I'm trying to figure out how to do this. I have many posts. I want it so that when someone pulls up the site, the front page shows all the posts that were done on the same month and day -- but ...
0
votes
1answer
65 views

Problem on wpdb queries, wp_insert_post, wp_insert_user etc. The query runs twice

Anyone encountered this issue? I have created a custom php script which adds a new post by using wp_insert_post() but everytime I run the code it creates a 2 new post where in it should be only be ...
0
votes
1answer
177 views

Retrieve and display data from custom db table in admin area?

So, i'm having a bit of an issue with a plugin i'm developing, I wonder if anyone can shed any light on the situation, as many, MANY searches have come back with zero help. :-/ Basically, my plugin ...
0
votes
1answer
22 views

How to query custom post type one after another

I am trying to query my custom post types. I can display both of them with this code: 'post_type'=> array('map','item') But I don't want them to mix. I want "map" to display before "item". ...
0
votes
1answer
65 views

Order posts by tags count?

I am trying to order posts by tag count. I want to order posts with no tags first and posts with highest count last. I tried and got posts with no tags only. $tags = get_tags(); $tag_ids = ...
1
vote
1answer
55 views

How to add posts to wp_query result?

I have 2 user groups: authors and clients Authors can publish posts and specify in metabox for wich client these post is ment for. Client can publish posts and view, edit posts, created by Authors ...
0
votes
1answer
26 views

How to get several fields from wp_query?

I'm going to get several fields from wp_query result. I know about wp_list_pluck() function, but it accepts only one field paramether. How to get several ones if I'd like to take several parameters ...
0
votes
1answer
23 views

Loads posts of different year via AJAX call

I need some advice with this one. I want to load posts of certain years depending what year the user clicks, to achieve this I have the following: <?php $args = array( 'post_type' ...