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

learn more… | top users | synonyms

2
votes
0answers
67 views

Custom WP_Query order by post_meta and (author) user_meta

I am having an issue that i couldn't find on google and elsewhere. To put problem in the context. I am making a wordpress site where user can put their tutor listing for giving a tutorials, and i am ...
1
vote
0answers
40 views

How to query all posts of a specific category, and any other category combination

Basically, I'm looking to query all post of category 'news', and any combination of other categories to display as Related News on single content type pages. So, if someone writes a post, and ...
1
vote
0answers
439 views

WP_Query orderby and tax_query

My goal is to have custom posts type's posts (CPT for simplicity) from a custom taxonomy (CT for simplicity) let say CT Hometown with slug Nebraska to be listed grouped by another CT, let say ...
1
vote
0answers
243 views

Slow meta_query with about 4 milion record on wp_postmeta

Although optimized wordpress all the way but still very slow as follows : I have converted from LONGTEXT meta_value field to TEXT Then create INDEX for this field ALTER TABLE wp_postmeta ADD INDEX ...
1
vote
0answers
512 views

Query by 2 values of a repeater ACF field

Let's say I have a custom post type called Film, with a repeater field called Showings, with fields start_datetime and discount. I need to make a query for those Films that have at least one showing ...
1
vote
0answers
745 views

How to get latest posts from each category in regular order

let's say I have a main query and it displays posts from Movies and Music categories. I want the query to show always 5 latest posts from Movies and 5 latest posts from Music category. When I create a ...
1
vote
0answers
26 views

Order posts with a custom field but also without

I am querying and ordering posts with this code but my theme adds the custom field (cb_vote_nb_vote) only if someone clicks the "vote" button, since I am doing a listing, posts created without that ...
1
vote
0answers
213 views

MySql Query very slow

I have a problem with a query on my website. When I load the page it is incredibly slow and only after over 12 seconds the content starts showing. I have installed a debug plugin and found the query ...
1
vote
0answers
59 views

wordpress query - orderby child post date

I have support ticket system which i have built using wordpress. The basic functionality is that when a "ticket" is created, it creates a post. When an admin replies, it then add a child post to the ...
1
vote
0answers
81 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 ...
1
vote
0answers
137 views

Post 2 Post Site Search

I'm trying to filter search terms bases on categorisation created by posts 2 posts. I'm using the generic site search and then I've created a search filter function my_filter_the_search($query){ ...
1
vote
0answers
58 views

Wordpress Query orderby title with UTF8 string in title

I got posts with titles are in utf8 encoding. When I query posts with orderby is title, those with utf8 characters at the beginning are at the end. Example: post title starts with Đ are at the end ...
1
vote
0answers
54 views

Sorting main query by custom taxonomy slug

Is there a way to sort posts by custom taxonomy (shoe_color) ASC|DESC? I would like to do this using query_posts and passing the orderby=shoe_color into it. Here is the code I'm trying to work out: ...
1
vote
0answers
138 views

Changing status of Published posts which have less Content to “Draft”

function draftpost(){ global $wpdb; $prefix = $wpdb->prefix; $wpdb->query("UPDATE ".$prefix."posts SET post_status='draft' WHERE LENGTH( post_content ) <500"); } ...
1
vote
0answers
333 views

WordPress Query wp-terms SLOW

I've got a very large database in WordPress with lots of products in WooCommerce along with quite a bit of taxonomies. When querying the products on the front end it takes 1 minute or more. Here is ...
1
vote
0answers
72 views

register_taxonomy() take much queries

Sorry for my poor English, I'm russian. I have a problem by adding a lot of taxonomies. When I added about 80 taxonomies, I get the following results(without caching): before: 44 queries 0.352 ...
1
vote
0answers
72 views

Why orderbyb meta_value_num won't affect the generated SQL Query order?

I've exhausted myself with this and I couldn't figure out why when I do this $myposts = new WP_Query( array('numberposts' => 5, 'offset' => '0', 'post_type' => 'noticias', 'orderby' => ...
1
vote
0answers
71 views

Dynamically adjust single-posttype.php query, based on current taxonomies

I have a single-teamphoto.php template loading data from a Team Photo - Custom Post Type, showing team photos with team member names below, one photo at a time, with a navigation list of available ...
1
vote
0answers
94 views

category pagination got broken suddenly

i need some help here please! The pagination just stopped working suddenly with the default post type and default wp query, with plugin "wp-paginate" or even with next/prev arrows! It echo 404 error ...
1
vote
0answers
331 views

Exclude posts with taxonomy term from appearing on home page query

I am really confused about this one, I am usually pretty good at working out basic queries but I can't seem to work this one out. Please see below my index.php query. Now it is not your basic query ...
0
votes
0answers
26 views

Querying on a custom post type without tags returns no posts

A theme I'm working on contains a custom post type, "help_question", which is declared as such in functions.php add_action( 'init', 'create_post_type' ); function create_post_type() { ...
0
votes
0answers
7 views

Query if audio attachment AND/OR custom field

I've been trying several things but to no avail... Searched, maybe not good enough though! I have posts that either have an uploaded audio file AND/OR has a Soundcloud link (which is a custom field). ...
0
votes
0answers
14 views

Add generic page to WP_Query

I have a query that gets all my custom post types of Service. I need to add a generic page (Classes) to the query so that I can use the orderby argument. I know the ID of the page I need to add. How ...
0
votes
0answers
9 views

MySQL query in Functions.php using inner join to override/add to search

I'm setting up a radial geo-location search. I have users select a zipcode and a radius to search within. I want to use the regular search site.com?/s=abcd&zipcode=90210&radius=10 I look up ...
0
votes
0answers
8 views

No results for taxonomy archive page

So, I'm making a taxonomy template page for a plugin, but I'm not getting any results from my query. I'm loading the template with this. function projects_categories( $taxonomy_template ) { if( ...
0
votes
0answers
12 views

WP Query for newest post of each taxonomie of a custom post type

I'm trying and googleing since 2 days, but cant figure out how I can display my 8 needed posts. Details about my structure: I'v created an custom post type "projects" where all the posts about ...
0
votes
0answers
10 views

Get adjacent post data, ordering by custom field values (by Wp-query?)

I want to build a custom version of the adjacent-function of wordpress post. I have two custom field values for each post, my layout is the following: metafield1 value 1 & metafield2 value 1 | ...
0
votes
0answers
10 views

How can I take input from a form, run it through a custom query, and display the results?

I'm having a good bit of trouble here. I'm working on a plugin that should be able to, among other things, allow the use of a shortcode to search through custom post types and their custom fields. I ...
0
votes
0answers
16 views

Problems with database query where two metavalue-key pairs meet condition

I've been trying to put together a database query where the different meta_values of two different meta_keys match the query. One example would be: delivery_date is '2015/06/11' AND supplier is ...
0
votes
0answers
22 views

Add custom field to string URL query

I recently took over a wordpress site from a former employee and I have 0 experience with this CMS aside from creating child themes. That being said, I'm trying to allow my search page to list out all ...
0
votes
0answers
34 views

Loading posts from another wordpress database on the same server

I've searched quite a while and found several solution but apparently I'm doing a lot of stuff wrong. I'm having 4 different Wordpress sites and need to load the latest 2 posts of each site. For ...
0
votes
0answers
8 views

Mysql join 2 columns into 1

Hello i could really use a hand here.. the thing is i want to make 2 tables for a project - 1: Shifts: - which has: id, usr_id, date, start_time, end_time, and pending - 2: shifts_extra: - which ...
0
votes
0answers
36 views

Query post by meta key of another table

Im using event calendar plugin where I can set event date for posts and it shows in calendar widget. Everything is working as inteded but I would also like to query post by event date. I know how to ...
0
votes
0answers
12 views

Search within multiple authors posts with Relevanssi

Is it possible to search within multiple authors posts? When I try to create a array and pass it to the query it gives me: explode() expects parameter 2 to be string, array given in ...
0
votes
0answers
19 views

Creating a top and display the top position inside post

I've create a top of the best football players in the world with a custom post type and i added to each player a custom field for goals/salary/country etc. Now i need to know if you guys have any ...
0
votes
0answers
23 views

WP Query - Group by relation (custom post type)

I have a custom post type Office. An office has an address, email, ... . An office also has a relation with a custom post type Region. So an Office must have a relation with a relation with one ...
0
votes
0answers
21 views

Search with array in Meta query

I have a meta key "group_roomtype" with value a:2:{i:0;a:2:{s:16:"roomtype";s:3:"265";s:11:"qty";s:3:"100";}i:1;a:2:{s:16:"roomtype";s:3:"266";s:11:"qty";s:3:"200";}} I want filter by qty, please ...
0
votes
0answers
31 views

Category list with subcategories and terms

I have a problem that I cant figure out myself. Maybe I'm going in a wrong way and thats's why it won't work. So I need a list of categories (custom post type "products"). I have some subcategories ...
0
votes
0answers
20 views

Search returning everything

<div class="page-head"> <h2 class="page-title"> <?php if ( have_posts() ) : ?> <?php printf( __( 'Search Results for: %s', ...
0
votes
0answers
43 views

Reorder results of select query by distance

What I'm trying to achieve is a store directory listing nearby stores, ordered by distance. I've managed to grab all the stores within the specified radius and display them, and also calculated the ...
0
votes
0answers
34 views

Query post by category using only one custom page template

Is it possible to query a post by category using only one custom page template? Basically I created a custom post called "Vehicle" and each post are assigned to a different a category. Instead of ...
0
votes
0answers
27 views

wpdb giving different results then query in SQL Editor

I'm trying to read candidates and the relation with expertises from 2 custom tables in my WP Database. This is my WPDB query : $candidates = $wpdb->get_results(" SELECT * FROM ...
0
votes
0answers
70 views

MySql query to retrieve post_title, post_content and feature image link BASED ON A CATEGORY

I have been trying for quite a long time to retrieve post_title, post_content and feature image link for all posts BASED ON A particular CATEGORY, from a wordpress database. I have got a query: ...
0
votes
0answers
25 views

Can I merge WP_Query and WP_Comment_Query together?

I have read about merging two WP_Query results. But I need to merge a WP_Query with a WP_Comment_Query and order the result by date. Is this possible? If so, how can I approach this? How would I ...
0
votes
0answers
23 views

Change the number of attachments loaded into the Media Popup window

I wish to ask if is there a way to change the numbers of thumbnails loaded in the media popup when it first opens. The Media Popup loads thumbnails through ajax (query-attachments), executing up to ...
0
votes
0answers
24 views

How to move posts in featured category on top and keep pagination

I want to move every post from category_id = 11 and 10 on top of the list and then query every other post which is only in 10th. I thought that making two loops will do the trick but there is a ...
0
votes
0answers
89 views

Command to make Woocommerce product variation price the same as its parent product price

The variations are stored in the wp_posts table like the products, but they are related to the parent product itself somehow. I just wanted a command to make all products variations prices same as ...
0
votes
0answers
30 views

Wordpress URL strings for filtering posts by category

I'm working on quite a large blog based site specifically on creating a category navigation system designed to display posts based on multiple category queries. I'm doing this using URLs such as ...
0
votes
0answers
94 views

Override default posts per page in taxonomy template

I am using the following code to show ordered list of posts in taxonomy page: <?php $mypage = (get_query_var('paged')) ? get_query_var('paged') : 1; $ppp = get_query_var('posts_per_page'); ...
0
votes
0answers
21 views

Query for distance OR taxonomy term

I'm using a custom query to retrieve posts with geo-coordinates within 10 miles of user coordinates and order them by distance. The query works as intended without issue. However, my client now ...