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

learn more… | top users | synonyms

3
votes
0answers
9 views

Is there any difference between hooks posts_where with posts_join and posts_search performance wise?

I want to know which filter hook I should use that performs faster. I did try both several times and I noticed that posts_search is a bit faster than using the combination of posts_where and ...
1
vote
0answers
213 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
135 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
72 views

Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin

I have a wordpress table like so (phpmyadmin and MySQL) | id | meta_key | meta_value | +----+-----------+------------+ | 1 | import_id | abc | | 2 | import_id | abc | | 3 | ...
1
vote
0answers
351 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
393 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
24 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
149 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
52 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
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 ...
1
vote
0answers
107 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
48 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
49 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
126 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
300 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
69 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
71 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
68 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
88 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
308 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
7 views

WP_User_Query. Whats wrong with 'relation' => 'OR'

I want all the users who meet either Condition1 OR Condition2. Sort by last_name. If I take condition1 AND condition2 ('relation' => 'AND'), the query is OK. If I take 'relation' => 'OR', I get all ...
0
votes
0answers
32 views

Handling Massive Amounts of Data in a Wordpress Plugin

I've been working on my own version of a Youtube Post Importer plugin for Wordpress and I've run into a bit of a wall. I'm using the 3rd version of the Youtube Data API seen here ...
0
votes
0answers
28 views

$post breaking container loop

Problem I have a foreach loop grabbing posts inside an advanced custom fields repeater. When it's finished looping through posts it breaks the repeater. I believe the problem is with $post as far as ...
0
votes
0answers
18 views

How to display near by post using latitude & longitude and The Haversine formula

I have a Custom Post Type called "events" that has Advanced Custom Fields "latitude" and "longitude". I'm trying to display all "events" within 75 miles of the user. This is what I have so far: ...
0
votes
0answers
23 views

Popular posts from 7 days loop

I'm trying to create a "loop" which will display Popular Post from a week or any other timeframe. What's the best way of doing it? Also, is it possible to order the posts by views? EDIT: Here is ...
0
votes
0answers
18 views

run search / query from multiple databases

First of I would like to warn everyone, that my skills set in mysql and php is novice. My current wordpress website is based on a network setup (mutli-site), with the help of shardb, I was able to ...
0
votes
0answers
12 views

Compare datetime

I have a query to fetch all the posts that have status: publish and post_date <> post_modified. Query: select id, post_title, post_date, post_modified from wp_posts where post_type='post' and ...
0
votes
0answers
23 views

Function to bypass specific words in search?

Is it possible for a word to be skipped/excluded/ignored in the default search? For example if I could make it so that if I type the great thing in the url instead of '?s=the+great+thing' it will ...
0
votes
0answers
37 views

Dynamically load content based on Title and Category

After googling for about 2 days now without finding the proper answer - and I must commit that I'm not that well educated in php programming, I hope the community may provide me with the correct ...
0
votes
0answers
30 views

Using wordpress with AJAX queries

I have built a custom theme for wordpress and I decided to use AJAX instead of just refreshing the page on each call. However, when I add the Wordpress loop to call in my data, it doesn't load at all, ...
0
votes
0answers
30 views

Sort by meta_key

I want to sort products by height, but some of my products like accessories don't contain height section and they're automatically disappear when I sort by height. Is it possible to sort by height ...
0
votes
0answers
23 views

Using offset with custom Archive page

Situation: News page - Currently shows the latest 5 news items Archive page - Starts on post 6, I've setup pagination. For testing purposes I've got 20 posts numbered 1 - 20. <?php ...
0
votes
0answers
24 views

Passing key to add_query_arg function

This is my edit link in template file $edit_link=add_query_arg( 'ser_edit', $post_id, $edit_link ) ; This is my html code. <a href="<?php print $edit_link;?>"><?php ...
0
votes
0answers
72 views

Ordering posts alphabetically by meta keys and title

I have a query for custom posts and I have managed to order the results alphabetically based on the title first then a 2nd alphabetical ordering of the 1st of 2 meta keys "Species". This works great. ...
0
votes
0answers
61 views

Import SQL tables from SQL file on plugin install

I'm building a plugin, on installation of the plugin it needs to create several tables. Now I found out that I can do that in the plugin code sorta like this.. // Function to create new database ...
0
votes
0answers
90 views

Get post ID and custom taxonomy of posts that belongs to certain category, efficient by SQL?

I have a large Wordpress site with almost 200 000 "posts" (everyday is aded more than 2000 new) and sppecific homepage with about 30 loops to get last 5 posts from every category (sngle loop = single ...
0
votes
0answers
103 views

Custom query to update user meta data (also with a custom table)?

I have add a custom table (wp_shopping_metavalues) to the WP install which looks like wp_usermeta. I am displaying user values from both tables. For the insert i use function ...
0
votes
0answers
28 views

What's going on with the get_pages() 'number' argument?

According to the codex, the get_pages() 'number' argument works the same as an SQL LIMIT. number (integer) Sets the number of Pages to list. This causes the SQL LIMIT value to be defined. ...
0
votes
0answers
20 views

Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?

I have the following problem with featured tag posts I have a page of a website in wich I want to show only the posts that have setted a specific tag (using the loop). So in this page I have put ...
0
votes
0answers
13 views

Why I have this strange behavior when I try to exlude the featured post from posts visualization?

I am quite new to WordPress theme development and I have a strange behavior with this custom theme on which I am working: http://lnx.asper-eritrea.com/ As you can see in the home page I have 2 areas ...
0
votes
0answers
23 views

Archive query not working correctly

I think I am missing something while trying to create an archive page for my post type I decided to put three levels of data in one post type and was going to separate it by templates depending on ...
0
votes
0answers
52 views

trying to update post meta in bulk

I have been trying to arrange my site so that my URL structure is set to domain.com/collection/%collection%/%product-group% Where %collection% is a taxonomy term, collection is the index, and ...
0
votes
0answers
152 views

Unserializeing multiple column values that are stored in one database results variable

Lately i have created a custom template to search for data in a database, and also displaying it, by the use of checkboxes. So, a user can select multiple checkboxes to search data on and the query ...
0
votes
0answers
66 views

How to group by custom posts by child taxonomy term

I have registered a custom post types named "property" , a custom taxonomy "city" is associated with that post type . I have couple of city like Ontario Toronto street 1 street 2 ...
0
votes
0answers
15 views

Incorporating a meta query into a mysql query in wordpress

I'm trying to find a way of inserting a meta condition into this bit of SQL below... $query = "SELECT COUNT( ID ) as num_events " . "FROM $wpdb->posts " . "WHERE ...
0
votes
0answers
39 views

Horizontally paginate through sets of blog posts?

I have my posts set up like this: I would like users to scroll through the posts using the left and right arrows. So when users click on the right arrow, for example, the next six posts would slide ...
0
votes
0answers
32 views

Title outside of the loop in page template

I have a page template, with a very simple default query. The problem is that the title is outside of the loop, because of the layout. What do you think, is it problem? Or do you know an other way? ...
0
votes
0answers
65 views

Problem with correctly registering query variable

I have an admin page for my plugin, which lists records from database. I want to sort them under some conditions. To call different sorting options, I've decided to use query string. Step 1: At ...
0
votes
0answers
59 views

Cron Job to Delete over 30 days old post from post type

This is my first time creating a WP cron job and I would like to have someone else review it for mistakes. I wrote this cron job to delete temporary wishlists that are over 30 days old. The wishlists ...
0
votes
0answers
61 views

How to organize a WP_Query's list of posts by category and display category title?

If I run a query with some args and get a list of posts, how can I organize the posts separated by category and display the title of each category? $array_out = array(); $args = array( 'orderby' ...