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
2answers
40 views

Complex WP SQL Query

I have tried the following SQL query without any success. Can anybody that have a better understanding of SQL help? Here is what I am trying to achieve: Get a list of all main events (ME) where the ...
0
votes
2answers
362 views

Bulk move (or copy) from a custom field to the post content?

I need to move (or copy) the contents of a custom field into the main post body, replacing any existing content. I need to do this for a few hundred posts...Is there a quick way of doing this? I can ...
0
votes
0answers
37 views

SQL query equivalent to WP User Query

I have the following WP user query code: //Get all users sorted by whatever $sorted_users = new WP_User_Query(array( 'orderby' => 'meta_value', 'meta_key' => 'satisfaction_rating', ...
1
vote
0answers
90 views

How to import a Typo3 database to a wordpress site?

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

SQL - Pull products of particular category from a remote WordPress woocommerce db

I connected to the db and successfully pulled products data. Now I want to to display products from specific category. The store is using woocommerce. The landing page is in different location so I ...
0
votes
0answers
14 views

How do I host a DLL web service from ASP.NET website in Wordpress site? [closed]

We're migrating from an ASP.NET website to a WordPress website, hosted on IIS (don't ask). There's a few things we need to migrate over, and for the most part I can get away with a simple HTTP ...
0
votes
0answers
19 views

Add a custom field via PhpMyAdmin to all posts and pages avoiding duplicates

I have about 200 pages and 400 posts on my WP site. And I need to add one custom field (sidebar_config: left-sidebar) to all pages and posts. I have this for SQL query in PhpMyAdmin: INSERT INTO ...
0
votes
0answers
13 views

SQL error on restoring database

I am running a database backup -- a 7 MB SQL -- using the phpMyAdmin Import function and getting an error, whose text doesn't really show where the problem is. MySQL said: Documentation #1064 - ...
0
votes
0answers
39 views

SQL query to get all nav menu items and their titles/label

I want to get a list of all nav menu items displayed in a menu having id "19" in my search page to match against the search string. I would like to get names of menu items as displayed on frontend. I ...
0
votes
1answer
41 views

Create Array from data in the OPTIONS table

Good Day everyone, I'm trying to create an array from data in the Options table of wordpress. My data all start the same way plugin_order_ and then name of the field information. Is there a way to ...
0
votes
1answer
301 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
301 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
53 views

Protect custom form from SQL injection

I'm trying to understand how to protect my custom form from possible attacks. I send a data via a form, let's say userdata, then I read it: $userdata = $_POST['userdata'] I put it into an array to ...
0
votes
1answer
2k views

Using AJAX to run SQL statement and populate dropdown

I am trying to create a search where the user selects two different bits of data from the database and it then prints some results that meet requirements. I know I need to use AJAX, or something ...
2
votes
2answers
45 views

SQL to check how many sites a user is a member of

I have a multisite installation and I'm working on creating a reporting plugin. One of the things that I would like to do is show the number of sites a user is a member of. Right now, I'm using ...
0
votes
3answers
344 views

Problems with moving my Wordpress site to another domain/server

I'm having problems moving a wordpress site from one domain to another. I've searched the site but couldn find a useful answer for my situation. Here's what i did: I made a backup of the website. ...
0
votes
1answer
19 views

Help with SQL query, how to add taxonomie terms with value stored in options?

i need your help in making SQL What i have: custom post type ( company ) taxonomie ( category ) applyed to cpt ( and has ct section select field ) custom taxonomie ( section ) applyed to nothing ...
2
votes
1answer
58 views

SQL query to get adjacent posts from search query

I'm busy rewritting a custom function I have recently written to get adjacent posts according to a tag, category, custom taxonomy term, author or search value saved in the URL I'm using the structure ...
1
vote
1answer
23 views

How change user type from contributor to author

I have 2058 users who are contributors. I need to convert their role to author. How can do it by SQL?
0
votes
2answers
43 views

Better way to migrate to server?

Migrating between local and server with Wordpress (SQL) is a bit time consuming, and I'm wondering if there is a better way to do it. With Drupal, there is a module called BackUp&Migrate, which ...
1
vote
0answers
55 views

Pull data and display as rows and columns

I am a noob when it comes to pulling data from tables and fields of a WP database so I'll explain it as best as I can without it running into a thesis. I have a table called WP_answer. In that table ...
0
votes
2answers
55 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
0answers
11 views

What are the steps to migrating my blog to a new host?

I recently bought hosting service with Namecheap. I backed up my db from my previous host and now want to migrate everything. I was restoring the db with phpMyAdmin, uploading the sql file, but this ...
0
votes
1answer
29 views

WP Sql query multiple where clause

I'm trying to get the users that have registered after a specific time (this case $today) and who have the newsletter field true and the account false. This is what I have so far but the result is ...
0
votes
1answer
99 views

Proper approach to moving complete site from one domain to another AND preserve widgets

I consider myself fairly versed in this matter, however I've recently had a rash of issues when moving sites. I am able to successfully move the site, edit wp-config.php, move the database, etc. ...
8
votes
6answers
41k 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 ...
1
vote
1answer
52 views

Add custom fields to search

I want to add a custom fields ("introduction" and "ensavoirplus") to search of Wordpress, but the SQL code is not exact. I don't understand if i do a mistake or if WP don't can do this. But my attempt ...
0
votes
0answers
39 views

How to merge 2 WordPress sites?

I have 2 WordPress sites, A and B. Each of them has users and posts. Now, I want to merge these sites. Points to be noted- A has 1000 users and 2000 posts. B has 500 users and 3000 posts. There are ...
0
votes
1answer
52 views

WPDB update row with != in where clause

I'm using wpdb to develop a plugin to add a custom form to wordpress. To update a row, I use an array and wpdb->update(). WP Class Reference says: My SQL code should be something like UPDATE ...
12
votes
4answers
22k views

WP_Query with “post_title LIKE 'something%'”?

I need to do a WP_Query with a LIKE on the post_title. I started with this regular WP_Query: $wp_query = new WP_Query( array ( 'post_type' => 'wp_exposants', ...
1
vote
0answers
23 views

delete duplicate comments

I found a solution for this a long time ago. Here is the code: <?php require_once('wp-config.php'); global $wpdb, $comment_content, $comments,$comment_ID; # First select all comments $query = ...
1
vote
2answers
1k views

How to Mass Delete Images from Media Library

I need your help. I am trying to mass delete attachments from a custom post type ('book') using a sql query. I found this snippet on the wordpress form: Wordpress.org I tested it on my local ...
0
votes
1answer
22 views

Creating a “forum” - showing last post or last commented post

thanks for reading! Im creating a forum just using categories and posts. I'd like (as most forums do) to show the last commented post or the last created post (which ever is newer) next to the ...
0
votes
1answer
36 views

Front end access to a SQL data repository - recommended way?

Building a general data repository, not necessarily related to WordPress elements. What is the recommended way of doing it: Using custom post types? or Building new SQL tables? Please elaborate. ...
0
votes
2answers
270 views

Insert Query not working in the form

Many people has asked the same question, I have read those things and mine is different, I am trying to insert some values inside the database from the form but it's not getting inserted I have a ...
0
votes
0answers
455 views

Custom SQL Query: Get all posts with category id and a concated list of tags on each post

I am trying to select all posts from a WordPress database, include few fields on each post, but most importantly I would like to also select the "category id" or each post, and ALL the tags that ...
0
votes
1answer
1k views

Export SQL query based on post type

I'm looking to export only wp_posts where post_type = post. Is that possible?
0
votes
1answer
28 views

Debugging WordPress

Looking for advice on debugging sql queries. I find that plugins and themes are causing heavy queries and slowing performance. Any easy ways for doing this? Tools? Shortcuts? Thanks! Daniel
0
votes
1answer
35 views

Minimize Performance Issues of MultiSite Large Number of Tables Created

I am deploying WordPress MultiSite and if I get a decent amount of users, I will have thousands of database tables to support all of these sites. I like the idea of consolidating all of these tables ...
0
votes
1answer
45 views

Query to get data of a post, if in category?

You would think you could use $query = new WP_Query(array( 'p' => $idofpost, 'cat' => $numbers )); to return the post if it is a certain category (or categories, or -number to exclude ...
0
votes
1answer
3k 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
253 views

SELECT * FROM $wpdb->posts WHERE ID > 160

I would like to retrieve all posts and relative tag with ID greater than 160. I tried: '$args=array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 5, 'orderby'=> ...
1
vote
1answer
44 views

Custom query to get terms from post ids

I want to get the terms object by given posts ids. I don't know much about sql, and this kinda complicated for me. Here is what i tried: global $wpdb; $taxonomy = 'category' $term= ...
0
votes
0answers
35 views

Unable to replace text string across site

There is a text string (a little over 1000 characters with spaces) that needs to be replaced across the entire of my website. The text recurs over 300 times on my site, is identical, and was been ...
0
votes
1answer
74 views

List of ways to access WordPress database?

I'm trying to get a complete understanding of how WordPress works with databases. I've read the documentation but I'm getting confused by all the different approaches available. So far my ...
1
vote
3answers
2k views

How do I add indexes to Wordpress Database?

I got a message from Hostgator about my account being suspended because of the load it put on their servers. This is about the fifth time this has happened. I am on a shared server. And they said it ...
0
votes
1answer
330 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
1answer
93 views

Bulk update post slugs through database

Is there a way to bulk update permalinks through the database? cause I have like 20k posts and all I want to do is add a prefix to the permalink. I could just manually update but that's too tiresome ...
0
votes
0answers
74 views

SQL command to export post_content from wp_posts using phpMyAdmin

I'm trying to select all the data from within the post_content column in the wp_posts table in WordPress so I can export/import it into a new database. Somehow this content didn't properly make it ...
0
votes
0answers
62 views

WP Query to order posts by multiple meta fields

This question might have an answer already in the forums, however I still wanted to ask it as this is a different more complicated version of the problem. The story: We have 2 meta fields for ...