1
vote
0answers
10 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 | ...
0
votes
1answer
36 views

SQL to update custom post taxonomies

I have a custom post "review". It uses the same categories and tags from default posts, so they share "category" and "tag" taxonomies. But later I changed the "review" register to have their own ...
0
votes
1answer
24 views

How to SQL query posts IDs by categories AND authors?

I am making a custom WP_Query and I need to come up with a SQL query that gets the posts IDs from X categories and Y authors. Then merge those IDs and put them in an array. I only need to figure out ...
-1
votes
1answer
8 views

The page that displays Posts on homepage

I want to know the page responsible for displaying the blog posts in WordPress. Where I can probably expect to find the SQL query and post rendering so I can edit some stuff by myself.
1
vote
1answer
38 views

Query Wordpress database by registered date and role

I would like to get the display name and email address for all users who have registered to my multisite today with the role of subscriber. It needs to be an SQL query as it's used outside of the WP ...
0
votes
0answers
85 views

SQL Query to select post thumbnail, post title, post content from a category

I use the db of my wordpress blog to develop a mobile application in Java. For this, I need the SQL query to display the thumbnail of a post, the title and the content in a selected category. I think ...
0
votes
0answers
71 views

Wpdb generates too many queries

I googled for hours, then found some codes on stackexchange (http://wordpress.stackexchange.com/a/108279/108270) and created the codes below. I'm trying to get alphabetical A-Z posts lists (e.g. A B C ...
0
votes
1answer
39 views

How to display data from db in select list [closed]

I wonder what it's wrong in my code. I can't get all of data in column "adres". In result I only have the lest record. Thanks for help. global $wpdb; $result = $wpdb->get_results ("SELECT ...
0
votes
1answer
140 views

Select column name dynamically mySQL Query

$country="USA"; $dr=$wpdb->get_results("SELECT $country FROM wp_shipping WHERE ID=$ids"); I want the above query in WordPress file, where country name is given dynamically but I am not getting ...
1
vote
1answer
120 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
88 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
78 views

Custom Wordpress SQL Query 4 posts per custom taxonomy

I'm currently developing a Wordpress website that has a large navigation that lists the 4 most recent posts within a hierarchical taxonomy. I dont have any experience with $wpdb, but it seems like ...
1
vote
2answers
501 views

Optional Meta Query

I have places stored as posts in WP's posts table. I am doing some geo-locating using Geo Data Store (http://wordpress.org/plugins/geo-data-store/). This is working great for me, as I can currently ...
0
votes
1answer
63 views

How do I query for posts by custom meta and those that have been stickied?

I realize how clumsy and inefficient this query is but SQL is not my strong point. I use the following query to pull the latest 8 events from a custom post type called Event Posts. However, I also ...
1
vote
1answer
107 views

wpdb query problem to access previous 3 days posts

I am trying to get all published posts titles by author id 2 most recent by post date for the last days. Here is my query: "SELECT post_title FROM $wpdb->posts WHERE post_status = 'publish' AND ...
0
votes
0answers
112 views

Special Query: Title, Terms, Content - %LIKE%

I'm working on a them theme that is search-heavy, and my users are putting huge priority on an improved search function. I think I will have to use a special direct query to search these things: ...
0
votes
1answer
72 views

learn to run wpdb class

I want to learn how to run commands through WP rather than SQL commands I have a SQL command: SELECT post_id, (select meta_value from wp_postmeta where meta_key = a 'geo_latitude' AND x.post_id = ...
1
vote
1answer
63 views

Wordpress Custom post query sorting does not work

I created a custom WP query to collect products that have 3 different taxonomy values in them and sorted them by price using the following: $my_products = new WP_Query( array( ...
0
votes
2answers
939 views

SQL query to get posts from multiple categories but not in a category

I need to get the last posts' ID and the post_tile within categories 1 and 2, and exclude those within category 3. It must be SQL, because if I use WP_Query it retrieves too much info and I only need ...
0
votes
1answer
275 views

Export all posts to import as product items

Up until now, my client has been using WordPress posts as his way to display his products. I now need to export all these posts into a CSV format so that I can format the CSV file and import it back ...
1
vote
1answer
106 views

Get the timout value of a saved transient?

Does anyone know if there is a Wordpress function to get the timeout value of a saved transient? I am using a transient with a 5 minute timeout to cache data from a web API call locally. Between ...
2
votes
1answer
216 views

Multipart/formatted MySQL query problem

I'm creating a plugin and I want to automate the creation of a MySQL Trigger on a table. The problem seems to be that $wpdb->query doesn't appear to accept either multipart statements and/or formatted ...
0
votes
2answers
852 views

How to rename a custom field?

I have 3000 posts with that custom field name 'refer' and i need to change it to 'ref' for theme needs, instead of doing it manually i need a query or technique to change them all. Question 1 I am ...
0
votes
2answers
362 views

Display latest post from Wordpress Featured Category that is also in X,Y,or Z categories

I want to display the latest post from a "featured" category (id=1) that may also be in either X category, Y category, or Z category (id=2,3,4 respectively). Note, there are other posts in categories ...
2
votes
1answer
707 views

orphaned taxonomy terms remove by sql query

I have 3 custom post types each of these CPT's have posts that are set to auto delete via a given time scale by cron jobs, thing is when they are deleted it leaves behind orphaned taxonomy terms in ...
3
votes
1answer
176 views

How to make an activities stream mixing posts and comments?

What I'm currently trying to make is an activities stream wich list : The posts, the comments, both mixed between them and ordered by date. My idea is to make two queries, but i don't know how to ...
6
votes
6answers
28k views

What SQL Query to do a simple find and replace

Whenever I create a new website I first create a staging site on a subdomain like "stage.domain-name.com". After everything works correctly I export the database, open it in notepad++ and do a ...
0
votes
1answer
2k views

Overriding default calendar to show posts from a category

I'm trying to modify the default WP calendar (get_calendar()) so that it shows posts from a specific category and then use that as a shortcode. Here's what I've done: Copied across the ...
2
votes
2answers
2k views

Alter query on edit.php

What's the best way to alter the query being run on the Posts Edit screen (edit.php)? The current method I'm using is by passing an argument to the global $wp_query like so: $wp_query->query( ...
20
votes
5answers
35k views

How to display sql query that ran in query?

I have come across a function before that displayed the exact SQL code that was used in a loop for example, but can't remember. Can anybody tell me that function? Cheers