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)

0
votes
1answer
703 views

How to retrieve sticky post in raw sql?

How I could made a sql query who retrieve all the sticky post in a wordpress database? This is because we use a new app over the old wordpress website database, and I don't know where Wordpress ...
0
votes
1answer
220 views

How can I convert everything from category X to have post format Link

My "links" come in from Windows Live Writer, from a perl based delicious sync directly to the database and who knows where from. They all have in common that the category is 'Daily-Links'. So I think ...
0
votes
1answer
466 views

latency problems with wordpress install (from SQL import)

I develop wordpress sites for a living, and today I am experiencing something that I haven't yet come across: Extremely slow load times / latency problems. You can view the site here: ...
0
votes
1answer
863 views

Can Anyone provide an example of RAW SQL for SELECTING posts by 2 or more tags

I need a RAW SQL, as I am working from different platform with WordPress Database. When I run example.com/tag/first+second, WordPress runs a query SELECT post_id, meta_key, meta_value FROM ...
0
votes
1answer
676 views

Troubles about insering a POST with a SQL query, post_status

I 'm using wordpress 3.0.5 I have to use sql for create post, here is my SQL query: $req = $bdd->prepare('INSERT INTO wp_posts ...
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 ...
0
votes
1answer
12 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
19 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
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
36 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
1answer
42 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
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
2answers
34 views

Is it possible to have more than 1 sql databases in my wordpress blog?

I m watching video on installing wordpress manually. on first launch wordpress prompts you to input your sql database name, sql password etc. then i can start working from dashboard. is it ...
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
0answers
28 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
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
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
35 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
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
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
91 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
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
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
15 views

How to change location, charset in Wordpress query [duplicate]

I have strange question. How Can I change or set a sql char set in wordpress. In wp_config.php I have: define('DB_CHARSET', 'utf8'); define('DB_COLLATE', 'utf8'); In my plugin I have this: global ...
0
votes
1answer
29 views

How to return value from sql and display it

In ordinary php I don't have that kind of problem I think but in WP this is a different story. I have query and I want return one value from "liczba_wodo" column. global $wpdb; if ...
0
votes
1answer
27 views

Querying multiple meta_keys in Wordpress SQL query

Here's my Query... I'm looking to narrow this query down to users of one specific role ("meta_key = 'wp_capabilities' AND meta_value = 'employee'")...how do I add that additional conditional to this ...
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
40 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
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, ...
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
1answer
125 views

mass delete posts based on metadata

I need to delete all posts that have a certain meta value for a certain meta key. I am looking for how to do this directly in the DB. So for instance, I have a meta field called "state", and I want to ...
0
votes
1answer
34 views

Extending the database

I'm trying to add an extra column to the comments database which will store the user ID of the post/page author. This is part of a plugin which will display new comments in reply to either a post or ...
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
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
199 views

Query sql for truncate post_content in wp_posts table

Hello all i need remove all info in Wordpress posts content and i'ld like do it from phpmyadmin with a query. I need remove only the text and images from all posts content but not the entire post, so ...
0
votes
1answer
116 views

When sorting WP_List_Table, table sorts, but I also get SQL errors

Here's my lovely prepare_items() function: function prepare_items() { global $wpdb; $table_name = $wpdb->prefix . 'blah'; $per_page = 100; $columns = $this->get_columns(); ...
0
votes
1answer
136 views

How to export database correctly for local to online

This process as a whole is fine... but I seem to have one small issue when I upload the database online. If I create a theme and modify some options that's fine for the local version. Once I upload ...