Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
6
votes
3answers
5k views

Set page template for all pages?

I know the page template is set in the wpdb as meta_key = _wp_page_template and meta_value = template.php. How can I write a SQL script to set each post where post_type = 'page' to a specific ...
1
vote
0answers
17 views

Alter query with posts_clauses to retrieve NULL values last

I'm running a query to order my posts first by book's author, and then by book's name. I'm trying to achieve something like this : Author A : Book A Author A : Book B Author B : Book F Author C : ...
0
votes
1answer
19 views

Custom array from a query only write the last row of the query

Looking for some input on this one. I am writing a custom array but having a strange issue. It seems to be cycling through the loop and dropping previous values and only storing the last row of the ...
0
votes
1answer
1k views

MySQL query for taxonomy-meta

I am working directly with MySQL, using MySQL workbench. Can you help me write a SQL query that will pull all custom taxonomies and their term-meta fields? I have a custom taxonomy called(slug) ...
0
votes
1answer
15 views

Regular XML-RPC timeouts

I am hoping to get some tips for troubleshooting this annoying timeout issue. Configuration: Windows 2012 R2 with IIS PHP 7.3 MySQL 5.7 Wordpress.org 5.3.2 WP is configured as network with 5 ...
1
vote
2answers
1k views

How to import a custom MySQL DB table into a WordPress custom post type

What I've done so far is create a plugin that creates a custom post type, takes a field(ID from the custom DB) and also creates a couple of page templates. I have a custom MySQL DB that is on the ...
0
votes
1answer
1k views

wp_insert_user is not working for me?

I have written a code for inserting wordpress user if I try to add new user I am getting an error for wp_insert_user like below : "Catchable fatal error: Object of class WP_Error could not be ...
0
votes
2answers
1k views

How to pass username into form that sends data to database

I am trying to pass username to database through form: [insert_php] $current_user= wp_get_current_user(); $id= $current_user->user_login; [/insert_php] <input type="hidden" name="id" value="[...
2
votes
2answers
1k views

Search & Remove Specific Shortcode From All Posts

Question Is there a way to remove a specific shortcode, say [print_me] from all the posts where it appears in one shot. And I don't mean mask it or filter it so it doesn't show up while it stays in ...
0
votes
1answer
30 views

cant insert data in a custom table in phpmyadmin

i created a dbdelta table but i cant seem to insert any data here is my code please help function lapizzeria_save_reservation() { global $wpdb; if(isset($_POST['reservation']) && $_POST['...
0
votes
1answer
985 views

Update post meta data (custom field) by post link

I have a post in my WordPress website, which has lot of custom fields. I have an Excel sheet with "post link" - "custom field data" combination. That custom field (video URL) is already set for each ...
0
votes
1answer
18 views

SQL query to change custom field in Wordpress database

I'm newbie in SQL questions, and today i have a big problem. I need change many fields in my SQL, about 4,5k. But have some rules to the query change, to don't change wrong fields where don't need ...
1
vote
1answer
435 views

Create table from array with prepare

Is it possible to create a table with the wpdb::prepare function? I read the documentation and tried to find examples but there where none that helped me. Even creating a table with prepare doesn't ...
0
votes
0answers
9 views

Wp_termmeta may be corrupted? Change on database doesn't reflect on website

By updating a plugin (ACF Pro) while there were permission errors on the server, a strange thing happened that I can't explain to myself in any way. Specifically, the wp_termmeta table, in which, ...
2
votes
2answers
2k views

Gaining Login Access via the Database

I have been given a job to amend a Wordpress site. I have only been given access to Cpanel. My questions are can i log in to the back end of Wordpress via Cpanel? If you can't login via Cpanel can i ...
0
votes
1answer
1k views

How do I merge WooCommerce categories with the same name?

I have duplicate product categories - they share the same name but different slugs eg., The category 'Adhesives' has a slug of "adhesives" but since updating my products via CSV import, there is now ...
1
vote
3answers
2k views

Get url of product's images (woocommerce)

What happen when a post (product) didnt have a guid,because it has the same image with another product ? For example: Query1: select guid from wp_posts where post_type='attachment' and ...
1
vote
0answers
14 views

get current date + 90 days and checking every day

User can submit post from frontend submission form. Fieldname: Title (entered by user) expire_date (entered by user) expire_date1 (invisible) expired (invisible) When user enter no value for "...
0
votes
1answer
447 views

Comment Approve - Add custom function when comment is approved

I would like to save some PHP memory when quering category page (like 5000 products at once) with average review rating, so I would like to save average rating of reviews every time I will manually ...
0
votes
1answer
29 views

What is this? MySQL array?

In my phpMyAdmin, one meta term, have this value: {a:1:{i:0s:82:"http://parquedasfeiras.online/wp-content/uploads/2019/12/alefit-e1576791796664.jpg”}} What is this? MySQL array type?
0
votes
1answer
1k views

Delete duplicate record in wp_postmeta

Some of my posts have two values for a meta key called cb_full_width_post. I want to only keep the records that have a meta value of nosidebar-narrow. This means I need to Identify records in ...
1
vote
1answer
915 views

Term and sub term from custom post type query

I have created a custom post type and taxonomy for a goods catalogue for a hire website. This works fine. I am trying to generate a report that lists all items and their category and sub category. I ...
0
votes
1answer
12 views

Bulk find & replace on Wordpress posts/pages (minus image paths)

I'm dealing with a tricky issue and wondering if anyone has a good way to solve this. I am trying to change everything on my Wordpress site that has "2019" in my posts/pages with "2020", however when ...
1
vote
1answer
578 views

MySQL variable in query

I've got tenant portal when I need to show running balance for each transaction. Here's query I've written which does what I need it to do. Problem I've got is that it doesn't work in Wordpress. Here'...
0
votes
1answer
20 views

dbDelta not CREATING TABLE

Here's my code. Please help function lapizzeria_database() { global $wpdb; global $lapizzeria_db_version; $lapizzeria_db_version = "1.0"; $table = $wpdb->prefix . 'reservation'; ...
0
votes
0answers
8 views

Get name of all term which is duplicate using Mysql

I am coding something to get all duplicate term which has duplicate name using MySql query. The issue I have currently is I am getting the records in a single occurrence I need all data which has same ...
0
votes
0answers
22 views

How to import woocommerce custom fields data into another site?

I m trying to import this product custom field data into my another wordpress site but its not showing any option to me when i try to import it into my other site ?
0
votes
0answers
25 views

Wordpress cloning issue

I have cloned my wordpress website abc.com using duplicator plugin. The clone is successfully installed and working on my other domain abccopy.com. But abc.com/wp-login.php page has a background image ...
0
votes
2answers
1k views

How to optimize 'select found_rows()' query? Several 'high load average' alerts daily

I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the wp_posts table quite large. Not to mention, I have custom taxonomies ...
2
votes
1answer
423 views

Converting mysql to $wpdb

I'm trying to convert this to using a $wpdb class. It will return all the enums possible and i have to use this $wpdb due to mysql_query giving me weird error (no database selected) Code is following ...
0
votes
2answers
865 views

You have an error in your SQL syntax - Help with query

I have a programmer that developed a custom plug in for a client's website and after moving the site to client's server, some parts are not working. Looking at the error log, there is an issue with ...
1
vote
1answer
33 views

WordPress post_status is future, manually added

My time zone is UTC+1. Now (and when the post creates the database): 2019-12-16 08:06:00 GMT (now): 2019-12-16 07:06:00 INSERT INTO `wp_posts` ( `ID`, `post_author`, `post_date`, `post_date_gmt`, `...
0
votes
1answer
13 views

How to edit content in WordPress and the Polylang – plugin? – with demosite

hello dear user, hello dear developer, the question; How to edit content in WordPress and the Polylang - plugin? first of all: i love PolyLang for its powerful features and the versatile options ...
0
votes
0answers
120 views

WordPress asks to install, but is already installed?

I know this has been resolved many times including here, but I can't figure this out in my case. I've been using XAMPP for Mac on Mojave and recently, I updated it to the latest version of - 7.3.1. ...
1
vote
1answer
15 views

join 2 table orders wordpress plugin

i have two table wp_wcfm_marketplace_orders wp_wcfm_affiliate_orders i need call data where wp_wcfm_affiliate_orders.orderid wp_wcfm_marketplace_orders.order_id it code call data table ...
0
votes
1answer
4k views

Replace existing pages with new pages, keep menu links

I basically want a plugin or method that would give the same functionality as 'Enable Media Replace' but for replacing pages and posts, instead of redirecting, or manually editing. I've searched high ...
1
vote
0answers
24 views

i have an error. Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\gudang\function.php [closed]

$conn = mysqli_connect("localhost", "root", "","gudang"); function query($query) { global $conn; $result = mysqli_query($conn, $query); $rows = []; while( $row = mysqli_fetch_assoc($...
1
vote
1answer
13 views

Bulk edit existing shortcode within custom field

I have a very similar question to this: Custom Fields Bulk Edit I would like to edit ALL of the data inside a custom field but instead of replacing values I would like to instead add an attribute to ...
1
vote
0answers
15 views

How to select from two different tables to display orders list with custom column from other table

I have a table which contains additional data about customers orders I want to create a table output on specific page when user loges in. when the user logs in I want to display to him all his orders ...
0
votes
1answer
454 views

Create a new table on the database and save parameters from a contact form

I have a wordpress function in functions.php which gets parameters from a form I made and gets parameters like IP addresses and UTM tags (from the URL) and sends them to me by email. I want to get ...
0
votes
1answer
506 views

The function is deprecated; use mysql_real_escape_string() instead

I don`t know coding. I recently my website stop to work properly. I get this error on the top of on every page loaded. Deprecated: mysql_escape_string(): This function is deprecated; use ...
0
votes
1answer
462 views

mySQL database size large, but tables size less

I have my site hosted with NetworkSolution, and they have a sql database size limit of 300MB. IF the size exceeds this limit we cannot access the wordpress admin dashboard. So currently its showing ...
1
vote
0answers
21 views

How do I get create a custom table showing the hours remaining for all customers in one page from this transactions page?

[insert_php] global $wpdb; $current_user = wp_get_current_user(); $emailAddress = $current_user->user_email; /*$emailAddress = "samplethis@youguessedit.com";*/ [YADDA YADDA YADDA CODE] "; /* ...
2
votes
1answer
24 views

SQL User Query by Multiple Roles using PHP

I can successfully get all my WordPress users using the following code: global $wpdb; $sql = 'SELECT * FROM ' . $wpdb->users; $users = $wpdb->get_results( $sql, 'ARRAY_A' ); However, I need to ...
1
vote
2answers
463 views

Mysql SELECT posts

how i can get posts via MYSQL from posts where language is 'en' and 'ru' I have this query $sql = "SELECT p1.*, wm2.meta_value FROM wp_posts p1 LEFT JOIN wp_postmeta wm1 ON ( wm1.post_id = p1....
0
votes
0answers
26 views

Wordpress database problem wp_posts, primary key

Repende my website in wordpress did not let me work properly, did not let me publish an article and showed me a problem in the editor show the message: "You are editing the page that shows your latest ...
0
votes
1answer
516 views

WordPress database error Duplicate entry for key 'slug'

I have just migrated to a new host and upgraded my Wordpress to 4.9.8 (from 3.9.x, embarrassing I know, plan to keep it up to date from now on). I also went through the process of replacing plugins ...
-1
votes
2answers
974 views

504/502 errors plauging our site

One of our sites keeps going offline and I'm running out of ideas. It's a wordpress site built with the Avada theme and it's goal is to server as a calendar of events using The Events Calendar plugin. ...
1
vote
0answers
24 views

How do I run SQL queries on a WordPress web page? [closed]

Whenever I Google this it brings up pages related to Database management. However, I want to run this in the actual webpage. For example: You go to a webpage where you can practice SQL: I.e. you ...
0
votes
2answers
533 views

mysql query - how to escape apostrophe?

I've got this query: $tenantsInfo = $wpdb->get_results("SELECT * FROM exp_ten WHERE tenant_number = " . (int) $user->ID); I use some echo to show data on frontend: if ($tenantsInfo) { ...