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
0answers
46 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
70 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 ...
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 ...
1
vote
1answer
95 views

find pods item where relationship to other pod is not set

I need to fix the effect of an error that left empty a relationship field that should have been autofilled. To fix this I need to find all pods item that has the relationship not set, but I don't ...
0
votes
1answer
75 views

How do I insert a new meta key / value pair, but only if another meta key is present?

I need to add a new meta key and value part only on posts where another key is present (regardless of its value). I tried to use a query to automate it, but my SQL is quite limited Here's what I ...
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
2answers
152 views

WPDB SQL query with prepare() returning variable, not db value

I have been trying to get this to work for awhile now and I cannot seem to get any farther on my own. It seems to work fine as a normal SQL query but not within the WP framework using prepare(). ...
0
votes
0answers
77 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 ...
-2
votes
1answer
1k views

cleaning up safely wordpress wp_postmeta table

In a effort to facilitate maintenance of my site, optimise page loading , and also helping out db migration , i am trying to cleanup the wordpress database of my site. i ahve realised the wp-postmeta ...
-1
votes
1answer
295 views

How to remove in the wordpress database all posts revisions except the last three?

here is the commonly recommended sql command for removing posts revisions and cleaning up the wp database: DELETE a,b,c FROM `wp_posts` a LEFT JOIN `wp_term_relationships` b ON (a.ID = b.object_id) ...
0
votes
1answer
124 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
62 views

wpdb_prepare with multiple or condition

I want to execute a query like this: $wpdb->prepare( "SELECT * ... from ... WHERE ( post_title LIKE '%%%s%%' or post_content LIKE '%%%s%%' )..., $string ); If I do the query with only one ...
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
2answers
78 views

How to use get_results() in widget front end?

I'm trying to get_results() in my widget's front end, this is my current code: public function widget( $args, $instance ) { echo $args['before_widget']; if($children = $wpdb->get_results( ...
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
47 views

How to concatenate two separate colums into one?

In phpmyadmin I have two separate columns for latitude and longitude. e.g. lat: '38.897683' lng:'-77.03649'. These coordinates are generated for my location custom posts. How can I automatically ...
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. ...
1
vote
1answer
69 views

posts_where Fails with More than One Custom Field in Query

Querying either of the 2 fields individually gives the expected result (posts are displayed). But, when both fields are included in the query (ex = 'foo' and 'bar' shown in below example), then no ...
1
vote
4answers
136 views

wordpress ajax relationship query

Using the relationship field from Advanced Custom Fields I link artists to events. Both these artist and events are custom post types. For each event, the post IDs of the related artists are stored in ...
0
votes
1answer
196 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
48 views

For a complete backup, is it enough to copy htdocs and export database?

I copied the htdocs via FTP from the server which hosts my wordpress blog. Moreover, I used phpMyAdmin to export the MySQL database. When I move to a new server, can I just create a database, run the ...
0
votes
1answer
115 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
135 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 ...
2
votes
2answers
201 views

Extending WP_Query — Optimise SQL query

I'm storing posts, a user follows in a custom table that has the columns id, post_id and user_id. To fetch posts that a user follows I have extended the WP_Query as follows: class ...
0
votes
1answer
33 views

Wordpress SQL - How to Check for Category?

I'm using the following SQL (wrapped in php) to find posts in a wordpress database: $sql = " SELECT p.* FROM {$wpdb->prefix}most_popular mp INNER JOIN ...
0
votes
1answer
103 views

SQL Query in WordPress - Getting Impossible WHERE error

I don't get any result in the SQL query below. I am trying to find user_id of users with custom usermeta fields. SELECT DISTINCT user_id FROM wp_usermeta WHERE ( ( ...
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
2answers
796 views

Getting value from database table depending on field value

I am using a plugin called formidable which is similar to Gravity Forms in terms of purpose. I have two fields of interest. The first field loads up all the values in the Town column of my ...
0
votes
2answers
70 views

How can I order metaboxes in my posts in WordPress?

hello i did add a custem filed and this is my code add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add() { add_meta_box( 'my-meta-box-id', 'المعلومات الرئيسية لفلل مشروع', ...
-1
votes
1answer
129 views

SQL query to check whether a meta key is set or not for a post in post_meta table

Condition: some post have meta_key 'status'. Please help me in with this condition: sql query for those post who don't have meta_key 'status'
0
votes
1answer
208 views

SQL: Select wordpress posts with given text string and add a custom field to them?

I want to select all wordpress posts that have a certain text string. Then to add a custom field to all those posts. Here is what I figured out so far but it doesn't work INSERT INTO wp_postmeta ...
0
votes
1answer
92 views

An action hook where a comment meta is updated

By analogy to the hook on post meta update, I use the following code for hooking when comment meta value is updated. My comment meta key is "consider" and can have 2 values: 0 and 1. My Goal is to ...
0
votes
2answers
96 views

count number of user comments with a specific comment meta value

I am using the code below to count the number of comments by a certain user: global $wpdb; $count = $wpdb->get_var( 'SELECT COUNT( comment_id ) FROM '. $wpdb->comments .' ...
1
vote
1answer
2k views

Using OR conditions in meta_query for query_posts argument

I have searched high and low for this but I cant seem to locate anything. I am trying to filter some results and when I make an args array like this and pass it to query_posts I noticed that the ...
0
votes
2answers
93 views

Which query method to use? (edit- wpdb syntax problems)

I am trying to create a query in order to get all the metadata from a custom post type named match_reports that is associated with a meta_key and meta_value in another custom post type named ...
0
votes
1answer
189 views

SQL Query to select post title & post ID from a particular category

I am looking for SQL query to select post title & post ID from a particular category. I looked at wordpress table structure but it is really confusing me.
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 ...
0
votes
1answer
49 views

count number of all comments by a user on different (non-repeated) posts

I thank you in advance for your help. I am using Wordpress for about 2 years, but always avoiding SQL inside my scripts and looking for built-in functions to perform my goals. To count the comments ...
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 = ...
1
vote
2answers
500 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
449 views

WP_Query with several meta_query-statements and order by meta_value

This is my query: $the_query = new WP_Query( array ( 'post_type' => 'pass', 'posts_per_page' => '-1', 'post_status' => 'publish', ...
0
votes
1answer
121 views

wpdb prepare sql problem

I have problem with wpdb prepare and sql query. If i run the query directly thru wpdb->get_results it's working fine. Here it is: $alabala_sql = $wpdb->prepare( " SELECT * FROM ...
0
votes
2answers
101 views

making php value numeric

I used some of this code from this page on Stack Overflow: Using wp_query is it possible to orderby taxonomy? It's about the function to be able to sort a query by a taxonomy value. Although it works ...
0
votes
2answers
748 views

Up/Down voting system for Wordpress

Looking in all posts with keywords "voting system, upvote, downvote", I can't find a satisfying solution for this issue, except accepting one of the available plugins, spend a lot of time undersanding ...
0
votes
1answer
176 views

SQL Bulk Move old posts by one author to another category

I'm looking to move a number of old posts by one author from one category to another category and was hoping someone could help me do this? I figure the easiest way would be through an SQL command? ...
0
votes
0answers
136 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
2answers
68 views

How can I get all author written content?

I have a site that needs two different tabs: 1. all author written content (Posts, comments, CTP) 2. all author followed content (categories, taxonomies, other users content) For the first all I ...
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 - ...
2
votes
1answer
91 views

Filter WordPress posts by between parameter

How to filter WordPress posts by a taxonomy and between parameter? Consider a mobile website with "memory size" taxonomy, I need to show posts that have more than 256 mb memory and less than 768 mb. ...