SQL (Structured Query Language) is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS).

learn more… | top users | synonyms (1)

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 ...
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
11 views

How to set search query for joining two tables in sql?

What's the wrong with this query? SELECT l.company_name,DISTINCT c.sub_cat_name FROM tbl_listing l,tbl_sub_category c WHERE l.company_name LIKE '%cy%' and l.city_id='2' and l.area_id=23 ORDER BY ...
0
votes
1answer
18 views

$wpdb->prepare with ON DUPLICATE KEY UPDATE

I just took this code from $wpdb Codex page, and modified my existing Insert query: $table = $wpdb->prefix . 'user_req'; $post_id = explode('_', $_POST['post_id']); $user_id = $_POST['user_id']; ...
0
votes
1answer
39 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
34 views

Is there a WP function to get taxonomy name from taxonomy_term_id?

I need to get the taxonomy name from the taxonomy_term_id. I am currently using the following to get it: global $wpdb; $term_taxonomy_table = $wpdb->prefix . "term_taxonomy"; $taxonomy = ...
0
votes
1answer
14 views

looking for a way to allow users to backup the plugin db data(save as)

I have a custom build plugin and I want to add the option to let the user save the plugin data(not using a thirdparty plugin to do this for me). So if a user clicks on the button it will allow them ...
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 ...
0
votes
1answer
51 views

Randomly select one of last 3 posts

ok so i have this: $args=array( 'orderby' => 'rand', 'order' => 'DESC', 'posts_per_page' => 1, 'offset' => $offset, ); $q = new ...
0
votes
1answer
15 views

optimise SQL wordpress call

I have this code : $querystr = " SELECT * FROM {$wpdb->prefix}posts INNER JOIN {$wpdb->prefix}postmeta m1 ON ( {$wpdb->prefix}posts.ID = m1.post_id ) INNER JOIN {$wpdb->prefix}postmeta ...
0
votes
1answer
33 views

Size article thumbnails and retrieve them directly from database

I've integrated the Wordpress database directly with my .NET application. What I want is to set the featured image of a post. This featured image must be maximum 800pixels wide, and automatically ...
0
votes
1answer
33 views

Removing links from posts in WordPress

I have few blogs for some clients. I need to remove links to one of my clients blogs in all posts. Just to be clear I need to remove links and my keyword should stay like it is. I found this plugin, ...
1
vote
0answers
13 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
282 views

$wpdb->insert() does not Insert record in a table

I'm trying to understand and get hold of the $wpdb global object but can't seem to make it work. Basically, I'm trying to insert a single record into a custom table in wordpress DB. Instead of ...
1
vote
0answers
70 views

Meta Query And/Or

My question is very similar to Meta Query with AND & OR? . This question was answered in 2011 by @Otto. With the exception that my logic is different. I want to query, for example, posts with ...
1
vote
0answers
173 views

Retrieve/get current image from Nextgen gallery db

I thought that I can do it using the database where the idea was to get the image from the ngg_gallery_pictures table, where the browser URL is equal to URL of the image in the table. Then I will get ...
0
votes
0answers
11 views

How to parse meta value from user specific post to google charts?

I'm currently working on a project where i need to visualize the progress of users (fitness). For that i have created a custom post type with custom fields. I want to parse the meta values associated ...
0
votes
0answers
21 views

Delete duplicate posts where meta_key is the same

I have imported some posts and this has caused some to be duplicated Each post (of a custom post type "property") should have a unique meta_key "import__id" value I need to delete all duplicate ...
0
votes
0answers
35 views

SQL query to remove first image in all posts

I've built a site up over a few years (3,500+ posts) where I've inserted images using the traditional method into the post content itself. I'm now moving to a different theme, and have made the first ...
0
votes
0answers
23 views

All images from posts of specific category

I'm photographer and am developing my own portfolio, it's in the final stage. I'm trying to get all images from posts in a specific category. I can actually get all images from all posts, but they ...
0
votes
0answers
26 views

Multiple taxonomy drill down filter on a collection of posts

I would like to add a drill down filter to a product catalog site with one main taxonomy, and three taxonomies that serve as additional filter for the main product category. The main plan is to build ...
0
votes
0answers
33 views

Custom WP_Query with SQL directives for getting posts by authors and terms

I am making a custom page where I need to display posts from authors and terms (categories). I tried with the built in WP_query arguments but I am not getting the result I want. So I want to know how ...
0
votes
0answers
12 views

WP query taxonomies not the same as output

I'm trying to build a custom query and I need to include the current category ID. I previously had the WP_Query args as: Array ( [post_status] => publish [posts_per_page] => -1 ...
0
votes
0answers
34 views

Order users by 2 custom fields in wpdb query

I've created a WordPress members site, each member is a user with the role of subsriber and has extra information set as custom fields - ie: address, contact details etc. I have the users output by ...
0
votes
0answers
14 views

error inserting value

Im kinda having some problem in my query and looks alright in my side and tested it in a localhost too. $query = "INSERT INTO$db_name(fname,pass) VALUES('".$_REQUEST['fname']."', ...
0
votes
0answers
37 views

$wpdb->prepare - supporting multiple search terms

I am trying to write an escaped SQL statement, for example: $sql = 'SELECT * from TABLE where column LIKE %searchterm% AND column LIKE %searchterm2%'; Except I don't know how to handle it, as I do ...
0
votes
0answers
87 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
20 views

Genesis framework comments broken?

I got a really weird problem. Im using a Child theme which using the Genesis framework. I was using Akismet plugin to stop the spammers and it was workin just fine. Recently i just made a comment by ...
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
0answers
21 views

SQL update post category by post starting letter

I need to update post category based on post first letter. E.g. all post starting with "A" should go into "A" category. so far i can only select posts starting with "A". SELECT * FROM wp_posts ...
0
votes
0answers
53 views

orderby in WP_query doesn't works

I thought that this already works but now I tested it and it seems that it no longer works. I have this code: wp_reset_query(); $args=array( 'posts_per_page' => 3, 'meta_key' => ...
0
votes
0answers
39 views

Delete duplicate custom field with specific vaule

I'm trying to delete specific custom fields that have been duplicated, however i only want to delete the fields with the value 0 in them. I currently have this code that will delete the duplicate ...
0
votes
0answers
35 views

problem in sql syntax

problem in Mashable Slider Clone plugin when upload it in server WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for ...
0
votes
0answers
19 views

How to import a Typo3 database to a wordpress site?

I have a SQL database export from a Typo3 site. Does anyone know know or have any experience of dealing with these cases?
0
votes
0answers
39 views

Delete posts without category with SQL

A website I am working on has a 'lost' category uncategorized. It got deleted and now I have thousands of posts without category. Those posts are old an need to be deleted. How can I do this with SQL ...
0
votes
0answers
27 views

On adding new field in post table my all posts not displaying in post section in php wordpress

I have created a module for posts. Now I have to modify this module by adding a new column to it. I have done it and it is working fine on local, but when I upload the code on live server, none of ...
0
votes
0answers
47 views

Delete junk text from all the post using my sql command

Because of an autoblog plugin, my site has got junk text in every post! The text format is as below .. funny-pictures/funny-pictures-of-the-day-30-pics/attachment/funny-pictures-41-2/" ...
0
votes
0answers
71 views

Is it ok to delete empty meta values

I'm using database peek http://wordpress.org/plugins/database-peek/ to show my database structure and have noticed that wp_postmeta has 95073 rows in it. I noticed that a large part of them have ...
0
votes
0answers
79 views

Wordpress on Microsoft SQL Server 2012?

I have a business requiremetn to host my Wordpress Server with a Microsoft SQL Server 2012 backend. I'm sure it's possible, but I don't quite know where to begin. Is this possible to implement without ...
0
votes
0answers
80 views

SQL Statement to sort custom query over multiple meta fields with duplicates?

i'm normally doing more Design/CSS stuff, so please be patient if this question is a nobrainer... My question is as follows: I have a custom post type, that has multiple custom fields. Now i need a ...
0
votes
0answers
57 views

Line break issues with textarea in admin for Attachments

I am not sure if this is an issue with Wordpress, PHP or the Attachments Plugin. I am using the Attachments plugin to save attachments to a post with some meta information. One of which is a caption ...
0
votes
0answers
44 views

Getting deleted users in database

I am using the database that is being used by a WordPress site. I am trying to get all the users from wp_users table with SQL query. But there is also previously deleted users in wp_users table. I ...
0
votes
0answers
62 views

Ranking authors by post meta value

I have custom post-type with custom post-meta and i want to rank authors by post meta value.I can show the SUM of a meta value on author page with this code <? php $points = ...
0
votes
0answers
141 views

Get posts under a category with SQL

How can I retrieve posts under a category with plain SQL with out using WordPress native api's like get_pages? My Wordpress table wp_terms contains a term named Restaurants. I want to list the post ...
0
votes
0answers
21 views

Advice or Best Practice on setting attributes and properties for user on login

I’m working on a web application service which is going to use a lot of the built-in Wordpress functionalities but also relies heavily on some customized code and tables to create - among others - ...
0
votes
0answers
73 views

Heavy SQL queries

I have got rid of one of SQL problems but the story isn't over. Now hoster has detected another problematic SQL query and again threatens to disable the account. Can anyone advise on what's going on ...
0
votes
0answers
247 views

Install WordPress with SQL database

I am very new to WordPress. I didn't even know it existed until I had to do it for my work. So I started in with a WAMP server with WordPress. That worked fine until we needed multiple sites with ...
0
votes
0answers
109 views

Using HyperDB to connect to a MS SQL database

I have successfully split my WordPress database into two MySQL databases (using hyperDB). And it works well. Now I want to dive into the unknown and have one database use MYSQL and the other MS ...
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
0answers
124 views

Convert date format in meta

I have been storing date format in meta key/value. I have been storing in this format (mm/dd/YYYY) now I need to convert that into (YYYYMMDD) SO I can run a date match in query. Please advice how can ...