Questions tagged [sql]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
19 views

Creating multiple tables with Plugin

I opened a new question, just to be sure. The former request has partly been resolved. I got another question regarding creating tables for wordpress: Only one table is created (The first one), but ...
1
vote
1answer
36 views

Problem with creating tables for Plugin

I hope someone can help me. I try to execute this code to install the tables for my Plugin. But for some reason it doesn't work (Doesn't appear in my wordpress database) and I can't find out why. Can ...
0
votes
0answers
18 views

Fail to establish database connection

I did a backup for my client's website for both the web files and sql. Now, I am trying to restore it to my cpanel. I have no problem restoring the web files but the sql automatically change the name ...
2
votes
1answer
47 views

how to execute different sql query in non-sanitized $wpdb->get_results function

I saw $wpdb->get_results that function is not sanitized by core code($wpdb is get_results escaped). For example, in following code $wpdb->get_results( "DELETE FROM `wp_postmeta` WHERE `...
0
votes
1answer
44 views

Using AND and bracket grouping in SQL not working

I am trying to combine two conditions in a query but it isn't working. but running the conditions independently works. LEt me explain. When I run this query: SELECT DISTINCT SQL_CALC_FOUND_ROWS ...
1
vote
1answer
33 views

Wordpress SQL Injections through User Agent

Currently Wordpress seems to be scoring bad on SQL Injection through User Agent. The testing tools that are being used return that it's insecure because it returns HTTP responses (errors) when you ...
1
vote
0answers
12 views

Needing to move content from postmeta to posts in sql [closed]

I have conent located in a custom field named main_content in wp_postmeta and need to copy that content to post_content in wp_posts. There are about 400 posts and have no sql background but should be ...
0
votes
0answers
23 views

Removing Malware

I've been asked to remove some Malware from a friend's site. I've found some wonky links in the wp_postmeta table, but the post_id that the field is associated with doesn't exist - and, weirdly, it's ...
0
votes
1answer
25 views

Use $wpdb or other PHP script method to find/replace in WP database

I'm hoping to push a bug fix for a custom WordPress plugin my sites use. The plugin registers a shortcode with various attributes. However, there's a bug where one of the attributes is incorrectly ...
1
vote
1answer
26 views

WP_POSTMETA changes site crash

I try to update wp_postmeta from SQL script. This is my original row in table: a:7:{s:16:"lambda_page_item";a:24:{i:0;a:9:{s:9:"grid_size";s:3:"940";s:7:"boxname&...
0
votes
1answer
30 views

SQL to set Display Name to First Name + Last Name

I'm trying to set the wp_users.display_name for a rather larger users db using SQL query. Got till this point: SELECT x.display_name, x.first_name, x.last_name FROM (SELECT u.display_name, f....
0
votes
0answers
11 views

WP Query - grouping posts by same meta key, adding together values from another key

I'm attempting to create a leaderboard for 8 teams that will play multiple games and earn different amount of points for each game. The setup will be pulling entries from a custom post type game, ...
0
votes
0answers
9 views

Custom User registration system

before asking this question I have been checking out other questions but still could find an answer. Please don't mind if I ask a silly question. The situation: I would like to build a user ...
0
votes
1answer
59 views

Performing CRUD operations on front end in wordpress

I'm currently trying to create a system where I can perform CRUD operations on a wordpress front end. I've seen a few plugins with shortcodes that allow this, so that is one possibility. However, ...
-1
votes
1answer
38 views

SQL to transform all email addresses in my DB in lowercase [closed]

how can I transform all email addresses in my DB in lowercase? I did an import and all addresses are uppercase and if a user registers again with lowercase the system thinks is another email. So I ...
0
votes
1answer
43 views

Connect to Ms SQL Server

I've been asked to develop custom plugins which will connect to a database hosted on MS SQL Server in different geographical location, i.e the website is hosted with a hosting service and the database ...
0
votes
2answers
28 views

How to Update post_modified of all wordpress post

i want to update all my wordpress post modified date and time to a specific date and time, i have a code to update it base on the id, but i want one to update all the row at once without putting the ...
0
votes
0answers
19 views

Lock wait timeout exceeded; try restarting transaction

I get the bottom error in the debug file. I don't know how can I solve it! خطای Lock wait timeout exceeded; try restarting transaction در پایگاه‌داده وردپرس برای دستور INSERT INTO `wp_options` (`...
0
votes
1answer
14 views

Correct PHP to output a single result of a Function with SQL Query

So I have created a function on a separate php inc page and want to output the single result of the function on another page. This is the function function get_all_rating_criteria_travel5(){ ...
0
votes
1answer
40 views

Search results sort order failing: set by date only

Hi the default wordpress search seems to be for "piano" SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%piano%') OR (wp_posts.post_excerpt ...
0
votes
0answers
20 views

“WordPress database error: You have an error in your SQL syntax” when using array_filter();

I try to update WP database custom table with form data and everything is OK. BUT one error doesn't give me peace of mind. WordPress database error: [You have an error in your SQL syntax; check the ...
0
votes
0answers
26 views

I wanted to Know that how can I give ingore to 0000-00-00 in my config file

I wanted to know that how can I give ignore to 0000-00-00 in my config file so that I didn't get an error of invalid value for this Zero-Date 0000-00-00 in my site database.
0
votes
0answers
14 views

How to use Multi SQL Database in Wordpress?

It is my wp-config.php of Wordpress site. <?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don't have to use ...
0
votes
1answer
36 views

Am receiving more than thousand mails in single day from 'sample@email.tst' continuously

Am using 'WP Offload SES Lite' Plugin to collect Question & Answer through forms. But yesterday I was receiving thousands of mail in a single day continuously. I think someone tried to hack the ...
0
votes
0answers
12 views

WordPress database(MySQL) sync with the MSSQL database

I have WordPress website and database(MySQL), I want to sync WordPress database to my other portal database(In MS SQL), is it possible to do it? Please guide me.
0
votes
0answers
21 views

Querying terms with calculations based on term meta data, sql vs. get_terms

Is it viable and or advisable to try and implement a query like the below through get_terms and its meta query functionality? Basically, I query terms of a specific taxonomy 'pr' that have meta fields ...
0
votes
0answers
13 views

SQL value returns blank?

In this function, I want item_id => 'A NUMBER'. That number can be found on the corresponding table row retrieved from my database, as written in the $parent_comment_id. After some tests, it seems ...
0
votes
0answers
72 views

Any way to use FETCH_KEY_PAIR with $wpdb?

I'm trying to get key/value pair results from a query like PDO's FETCH_KEY_PAIR from a $wpdb query. The closest I found was the OBJECT_K output from get_results(). But that returns the key, but for ...
0
votes
0answers
13 views

Add a Custom Field and his value via SQL

I need a SQL query to add a custom field and his value to a wild number of posts (more than 5000 I think, this is an old news site). Some post that I manually updated for SEO already have that custom ...
0
votes
0answers
12 views

how to list all post that are in the custom taxonomy using $wpdb

global $wpdb; $custom_post_type = 'post'; // define your custom post type slug here // A sql query to return all post titles $results = $wpdb->get_results( $wpdb->prepare( "SELECT ID, ...
0
votes
0answers
5 views

Put a database alias on the args parameter from the Wordpress post_clauses filter

Well, I'm trying to geolocalize products on the search engine from the Woocomerce plugin. I manage to see that everything works from filters that can be added inside the method ...
0
votes
0answers
17 views

WooCommerce get specific orders by Customer ID SQL

Trying to get specific orders by the customer ID via a raw SQL query. I'd like to input which order IDs I'd like to retrieve, but only retrieve them if they match a specific customer ID, here's what I ...
0
votes
1answer
41 views

Display a number value from mysql query in WP

Anyone have a suggestion on how I can display the result of a SQL query in a WP post or page? The query statement is a SUM statement and I want to only display the resulting number value on the page. ...
0
votes
1answer
14 views

WP_query has incorrect wp_posts.post_name = 'asc' when I have custom post type called 'order'

This is my code : print_r($args) //Output array(6) { ["post_type"] => string(9) "order" ["date_query"] => array(2) { ["before&...
0
votes
0answers
7 views

all values not stock in array after request

I m working on a plugin. I get some values from db and put in array for create programmatically some pages. So, before the creation; he match the name in the array with the value of db if not exist, ...
0
votes
0answers
14 views

Good request for get id

Actually, i m trying to get id from the combinations of two table for display in differents pages. I have: wp_keyword id | keyword | id_secteur (join at wp_secteurs on id_secteurs) 1 agence web ...
0
votes
0answers
43 views

How to store sensitive user data (passwords)

I want to create a plugin addon that allows my sites users to share private login information in a secure manner. So they'll enter these private details in a form on the frontend and I want to be able ...
0
votes
1answer
101 views

CREATE TABLE with dbDelta does not create table

I based this code from the codex on the docs. I placed it in my main plugin file but it's not creating the database table. Have I missed something? // Database setup and hooks function ...
0
votes
1answer
17 views

How can I add a new row in a separate database when someone registers via Wordpress?

Apologies if this is question is too general or in the wrong location but I am new to SQL, Wordpress and web hosting. So I am a game developer using Unity C# to create a multiplayer game. I am using ...
0
votes
1answer
78 views

Looping the data from WordPress database using foreach

I am trying to fetch data from the WordPress database table using wpdb and loop it using foreach statement so as to output results in select tag. I created a custom WordPress template and this was to ...
0
votes
0answers
16 views

Job and Employee Performance Tracking with Product Safety

We are looking to connect a WordPress site to our database where an employee can scan an order barcode with an RFID scanner that was generated from our database and have the WordPress site query the ...
0
votes
1answer
54 views

get woocommerce product image url and price from database [closed]

I want to get some product data directly from the database, currently I have this, but I'm missing the featured image URL: SELECT p.ID, p.post_title, `post_content`, `post_excerpt`, t.name ...
0
votes
1answer
44 views

Clear Terms from Taxonomy for Specific Post IDs?

Trying figure out how I can use some SQL/$wpdb->query to delete all the terms from a taxonomy that are related to specific post IDs. The following works beautifully to delete all the terms from a ...
1
vote
0answers
22 views

Prevent duplicate records in plugin table

I'm working on a plugin that keeps track of like counts on every post in the site. When the plugin is activated a custom table is created to store all the data. The plugin then checks on every page ...
0
votes
0answers
14 views

sort title descending with title with number

please help me, i have title like this '1-nen A-gumi no Monster Chapter 2' '1-nen A-gumi no Monster Chapter 10' '1-nen A-gumi no Monster Chapter 2' '1-nen A-gumi no Monster Chapter 1' '1-nen A-gumi no ...
0
votes
1answer
41 views

Delete oldest wordpress post (SQL query)

I've reached the database limit on my hosting platform. I want to add a function to my functions.php that deletes the oldest post in my database anytime that I publish a new post. function ...
0
votes
0answers
27 views

How to optimize query which remove duplicates for 2 million items

Good evening, This is my query which should remove duplicates from table. How can I optimize this for two milion records? DELETE p1 FROM wp_ads_platform_users p1 INNER JOIN wp_ads_platform_users p2 ...
-1
votes
1answer
44 views

How to write inner join using posts_clauses?

Can someone please show me how I can achieve the same result with this SQL: SELECT * FROM wp_2_posts INNER JOIN wp_2_icl_translations ON wp_2_icl_translations.element_id = wp_2_posts.id AND ...
0
votes
1answer
196 views

How To Write An Inner Join With WP Query

I have a ACF relationship field for a custom post type, properties. Moreover, the content of these properties can either be in English or Spanish. When I use a ACF relationship field to associate ...
0
votes
1answer
101 views

show badge with count for pending items in custom post type

This code I have is working but I am not sure if it is the right way to do this. Basically when a user adds a record to a custom post type it goes straight to pending and needs an admin to publish it. ...

1
2 3 4 5
15