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
6 views

How to query results for post_title and Custom Post Type/ACF field pivot query

I have a custom query that needs to match a search term to a custom post type of event by post title and by an ACF field host and then filters out events that have passed the current date to a REST ...
0
votes
1answer
12 views

I want to get on those users their meta value are like “AGENT” .. but this query is not working

SELECT display_name FROM $wpdb->users WHERE id IN (SELECT user_id from $wpdb->usermeta where meta_value LIKE '%agent%')
0
votes
0answers
12 views

Taxonomy list inside the query

Is it possible to get a list of the "terms of taxonomy" or "just used taxonomy types" defined within that archive without looking at all pages of an archive query in a loop? What I ...
0
votes
0answers
16 views

Customising the default wordpress search functionality

I find the current from WordPress too strict as it doesn't allow for some minor spelling mistakes. How can I edit this function? I was checking out pre-get-posts however I don't think that allows me ...
1
vote
0answers
15 views

Editing the default wordpress search

My wordpress sites search function is not relaxed enough for my liking. I want it to match more items and be less strict. How would i do this? I was thinking it would to do a pre-get posts filter but ...
1
vote
2answers
25 views

Difficulty importing my live site to local

Im using local by flywheel, Here are the steps i have taken so far: Installed local by flywheel and created a site called stage Downloaded the website from CPanel and also the SQL database Imported ...
0
votes
1answer
45 views

wpdb->get_row is selecting the variable as a column name

I'm using wpdb to get a row of a table $file = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}vip_files WHERE {$file_hash} = `hashcode`&...
0
votes
1answer
18 views

Run a sql (update) after 12 hours after the user login. Woocommerce users

How can I Run a sql (update) after 12 hours after the user login (for Woocommerce users) After 12 hours after a user login, I want to run a sql/ function to update a value in the database. To set a ...
0
votes
2answers
20 views

Display data from phpMyAdmin with WordPress

I have imported my website to Wordpress and facing a big issue how can I do sql Query to display data on my pages with wordpress? for example I have product, price, description which I need to display ...
0
votes
0answers
22 views

How delete post_content records of specific category from phpmyadmin

I need a SQL command to delete post_content records for specific category's posts
0
votes
1answer
24 views

SQL Bulk update all Wordpress user's nicknames to firstname + lastname format

I'm trying to bulk update all my users on one of my Wordpress sites to so that their nicknames aren't the default username but have the format firstname + lastname instead. I've put together this code ...
0
votes
0answers
28 views

Sql query to get all metadata for a post

I have three tables in my database one is users table the other is posts and wp_post meta. In the user table I have all the user details . In the wp_posts table I have different posts types . I want ...
0
votes
1answer
25 views

How to get database connection details without longing to cpanel in WordPress?

I am creating a WordPress plugin and in my plugin i need to do some SQL statements ,in the site i am working on i have access to WP-admin but i cant get to the files to get database name and password ...
0
votes
2answers
16 views

Which data is written and stored in the database when read-only (non-posting, non-commenting) users visit the site?

With a default Wordpress install, with no plugin installed, does the read-only visiting of the website generates write operations in the database? By read-only, I mean: visitors come and don't post ...
1
vote
2answers
31 views

Syntax for $wpdb->prepare when searching in two columns

I have this working statement for searching a single column in my database: $foods = $wpdb->get_results( $wpdb->prepare( "SELECT id, foodname, namevariations, calories, carbs, fat, protein, ...
0
votes
0answers
23 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
37 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 ...
2
votes
1answer
57 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
36 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
29 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
30 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
29 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
56 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
12 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
12 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
181 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
43 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
157 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
34 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
29 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
43 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
29 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
32 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
15 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
71 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
16 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
22 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
97 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
13 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
43 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
53 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
16 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 ...

1
2 3 4 5
15