Questions tagged [mysql]

MySQL is an open-source, relational database management system.

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

Wordpress DROP tables with prefix

Hi I am trying to drop some tables in bulk before creating them again for testing purposes. I am trying to run this statement dbDelta( "SET GROUP_CONCAT_MAX_LEN=10000; SET @tbls = (...
1
vote
1answer
26 views

Wordpress doesn't save changes some times

I have an wordpress website and have a lots of user's that write content in it. Sometimes when users edit or create new post and save it, after refresh it disappeared. I have a backup system that ...
0
votes
0answers
9 views

Is MariaDB's Aria storage engine suitable for WordPress?

MySQL sites are steadily migrating away from the older MyISAM storage engine to InnoDB. That's because InnoDB has better recovery and row-by-row transaction locking support. At the same time, many ...
0
votes
1answer
11 views

User set date and time from frontend doesn't get stored into database

My application lets users store diary entries into a database table. They are free to set the date and time to what they need using html inputs (so I can't simply use the current time because they ...
1
vote
1answer
19 views

How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?

While searching with the argument s it adds additional value before and after each Like query SELECT wp_7_posts.ID FROM wp_7_posts WHERE 1=1 AND (((wp_7_posts.post_title LIKE '{...
0
votes
1answer
27 views

How I can change the condition or compare operator for WP_Query in pre_get_posts

So here is my problem I want to show Posts if have same category if not have post then show post of same tag. And to do that I am using "pre_get_posts" action. and setting query like ...
0
votes
0answers
6 views

Getting all data from wp_postmeta and wp_md_post_meta

SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.id = wp_postmeta.post_id ) INNER JOIN wp_mf_post_meta ON ( wp_posts.id = ...
0
votes
1answer
31 views

Wpdb query with dynamic table name

I have a separate custom table in my database for each language I'm providing for my website. I need to select the correct table dynamically from a variable that is sent from a POST request. First I ...
1
vote
1answer
27 views

Match tag names with form titles

I am trying to match tag names with form titles to fetch the correct form into the current post, to subscribe to new posts tagged with the current posts tag. I only have 1 tag assigned per post. The ...
-1
votes
2answers
23 views

How to Delete Posts by title?

I have about 2000 titles. How can I automatically delete posts with these titles? For example
0
votes
0answers
15 views

Saving two values in dropdown select as separate meta keys in MySql

After two days of research and testing, I am totally stumped on how to correctly parse two unique values from a select field and save each to my database as separate meta key/value pairs. The dropdown ...
0
votes
1answer
18 views

Delete all users with Editor role and their content mysql

I have a Wordpress site with thousands of editors. I cant delete them from the WP dashboard as its to slow. I need a query to delete all the editor users and their posts from PhpMyAdmin? Thanks
0
votes
1answer
35 views

AWS Lightsail Wordpress - connect to database on instance using mysqli

I have a wordpress website hosted on AWS Lightsail. On that website, I would like to use a shortcode to retrieve data from a database using mysqli. However, everytime the script that connects to the ...
0
votes
0answers
14 views

Cant create table on plugin activation

I am trying to create table on plugin activation, I tried making the same function inside the class and calling it from the constructor, and I tried calling it outside the class and finally i tried to ...
0
votes
1answer
11 views

get posts whether meta_key exists or not

I am trying to get custom posts using $wpdb->get_results() as follows: SELECT p.ID, p.post_content, p.post_title, p.post_excerpt, pm1.meta_value as meal_date, (case when pm2.meta_key is null then ...
0
votes
0answers
11 views

Saving wp.media URL to database

I am having trouble saving the selected wp.media attachment URL to the database. The value of the hidden input seems to get the value, but the value is not being stored in the database. <?php ...
0
votes
1answer
13 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
1answer
40 views

Most commented posts by time period (last 12h, last 24h and etc)

I have this code which works great. <?php $result = $wpdb->get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 25"); // ...
0
votes
0answers
8 views

How to write tax_query equivalent to meta_query

i have written wp_query using meta_query but now since the db size is increased the queries getting slow so i coverted my meta_query to tax_query but some of them are difficult to covert due to ...
0
votes
1answer
11 views

Error missing MySQL extension

Yesterday I delete some files to clean up my storage. After that, I face the following error while visiting my website. Your PHP installation appears to be missing the MySQL extension which is ...
0
votes
0answers
11 views

Import XML file into database but escape some of the XML tags

I'm able to successfully import XML files into a table in my database with the following query: LOAD XML INFILE "myFileName.xml" INTO TABLE t_orig2 ROWS IDENTIFIED BY '<verse>'; ...
0
votes
0answers
14 views

Unable to update wordpress due to database error unknown column

I get this error in my wordpress error log [05-Mar-2021 04:10:10 UTC]WordPress database error Unknown column 'tickbox_auto' in 'where clause' for query SELECT * FROM wpdx_payment_discount WHERE status ...
0
votes
1answer
62 views

Get All Results From Other Users That Share The Same Custom User Meta As Current User

I am pretty new to extending wordpress and trying to get my head around using Mysql and PHP to fetch data into a html table and print it on a wp page. What i have so far is fetching all form data to ...
0
votes
0answers
18 views

Real time post display on home page (as soon as they are published)

I have noticed this becoming a trend with comments and now posts. I'm sure many sites (especially community ones) will implement this. Here's exactly what I mean, click here: https://stackexchange.com/...
0
votes
0answers
9 views

How can I get variation products that their variations are on sale with raw sql

I'm building a WordPress multisite. And I have shortcode that fetches on sale products. But it doesn't get variation products because they can't be "on sale". Only their variations can be &...
0
votes
0answers
111 views

call to undefined function mysql_connect

Trying to run a search and replace but am getting an error Call to undefined function mysql_connect() in E:\xampp\htdocs\test\wp-includes\wp-db.php:1688 I have checked my WP files and have both ...
0
votes
1answer
27 views

Multiple meta_key in one global $wpdb;

I have this code which works great: global $wpdb; $ticker_tag = $wpdb->get_col( "SELECT meta_value, COUNT(*) AS c FROM $wpdb->postmeta WHERE meta_key = 'ticker' GROUP BY meta_value ...
0
votes
1answer
26 views

Improve wp query perfomance on large db

I have 100000 records in my database and so many meta query performed on it so it takes lot of time to perform the operation, what is the way to speed up this? It takes 20 to 25s to load this query. ...
1
vote
0answers
31 views

pagination with 'no_found_rows' => true,

I have 100000 records in my database and so many meta query performed on it so it takes lot of time to perform the operation, have checked few articles and using them it suggest disable no_rows_found ...
0
votes
0answers
10 views

Change site url when moving site to another url keeps the old url

I'm trying to migrate a Wordpress instance from oldURL to newURL but the links in the Wordpress still pointing to the old url This what I have done: wp option update home newURL UPDATE wp_options ...
2
votes
1answer
38 views

How does wordpress blocks?

Couldnt find an answer on this one so thought id ask here. So you have pages which are a post type, On each page you have the post_content which in my case - Is just a bunch of other blocks, Eg in SQL ...
0
votes
0answers
18 views

I want to select all users who have “Contributor” role and assign a custom role “edd_subscriber”

I'm trying to build a script which can select all the users from database who have assigned role "contributor" and then change their role from "contributor" to "EDD Subscriber&...
0
votes
0answers
7 views

Recovery - Restore Database after moving folder location locally

I made a bit of an error over the weekend. I moved the local installation of XAMPP and subsequently broke my entire local dev Wordpress install. I have all of the folders intact from XAMPP including ...
0
votes
1answer
29 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
0answers
22 views

How optimize website for massive MySQL writing?

I have a website that using plugin RSS Feed Post Generator and there are hundreds post publishing in hours and the MySQL database is busy every time and it cause to heavy loading for main page and ...
1
vote
1answer
22 views

Query String being Removed Creating a Pagination Issue within a Custom Plugin

I created simple custom WordPress plugin for a client in 2016 that simply displays a paginated list of results queried from a custom table. try { $recordcountquery = 'SELECT FName,...
2
votes
1answer
315 views

How to get data from Wordpress $wpdb into React Gutenberg Blocks Frontend?

I am using $wpdb to do a mysql query and get the data from a php file. $results = $wpdb->get_results("SELECT * FROM table_name"); Now, I have registered a Gutenberg block with the ...
0
votes
0answers
13 views

Configure next post id (due WoComerce) to skip several numbers

I have backup and restore a wp that failed and in-between few wocomerce orders are lost (they are in the non working backup) can I set the next wp post (wocomerce save orders as posts, how original) ...
1
vote
1answer
33 views

add_post_meta does not respect the content

I insert this and it works fine: add_post_meta( get_the_ID(), 'robots', 'TEXT', true ); After adding that, I check the database and everything is fine, the result is TEXT. But if I insert this: ...
1
vote
1answer
43 views

How to check if a meta value has already been assigned to any user?

On my website I automatically generate an 8-digits random number $rndnr via wp_rand() during the registration process and save it as user meta. How can I check if this number has already been assigned ...
0
votes
0answers
21 views

WordPress MySQL update

Help me correct this code. public function new_product($product = array()) { if ($product['product_name'] == '') return; global $wpdb; $table_name = $wpdb->prefix . '...
0
votes
0answers
11 views

Weird fonts showing which are coming from database

Recently my website was hacked. Then I recovered it and uploaded files to server. But I can see there are lot of weird fonts showing in the site like headers, footers, contents etc. I am not sure what ...
0
votes
1answer
25 views

How to improve my non-unique metadata MySQL entries?

I'm working on a plugin for WooCommerce which uses a cpt called Restock. In a Restock post you can enter products ( id ) plus restock. The user can add as many product restock pairs as they want per ...
0
votes
0answers
11 views

How to alter default post gallery settings from SQL?

I want to change my default posts gallery settings value. for example, Size= Full Size, Link to = none, Column = 5 for my all old published gallery. I found some PHP hard code functions for doing this ...
1
vote
0answers
22 views

Dynamic dropdown from database table

I need a little help: I want to create a drop-down populated by mysql database table with two options: Select option 1 (regions) Select option 2 (schools) Where in option 2 appears populated according ...
0
votes
0answers
19 views

Getting wp_post objects from a single custom INNER JOIN SQL request

I have a custom plugin (written by me) that has, for reasons, got a custom table which contains a post_id field. It makes sense in context. What I currently do is SELECT post_id FROM table_name WHERE ...
0
votes
1answer
45 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 ...
0
votes
0answers
23 views

Database error: You have an error in your SQL syntax term_taxonomy

It's been a while since this syntax error has been happening, I tried to look it up, have read articles and forum's posts on this issue, but I still couldn't fix it. It says I have an error on my ...
0
votes
2answers
33 views

how update data through ajax and jquery

I try to update data through ajax, but it not worked. What I did wrong? Here is jquery ajax code php code in functions.php function update_records(){ global $wpdb; echo $id = $_POST['update_record'...
0
votes
1answer
19 views

Upload media only to DB

I'm using the latest WordPress (5.6) and from what I've found out there's no visible setting for uploading media directly to a DB. Is there such an option somewhere hidden or does WordPress not ...

1
2 3 4 5
30