Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
7k views

Send checkbox status with Ajax / JSON and save it

the task is actually quite simple I believe. I want to query the status of a checkbox, pass it with $.post and JSON to a function, and then save the value. my-html (relevant part) <input type="...
0
votes
2answers
699 views

WP MultiSite: Can't select database error after changing to new domain

I've been developing a WP Multisite on a temp URL for some time now. The site is ready, so I changed my settings around, did a find and replace in SQL from the temp domain to the permanent domain, ...
2
votes
1answer
112 views

Wordpress widget new instance creates content duplicates

I have a custom made widget that I wrote and I want to display two instances of the same widget in the same widget area. When I drag and drop new widget instance to the widget area inside admin panel ...
0
votes
0answers
47 views

Improving performance of SQL sub-queries in WordPress

We're using WooCommerce and WooCommerce subscriptions with approximately 23K users. While this question doesn't require that a user be using those plugins, I'm generally wondering how to better ...
1
vote
1answer
563 views

Update slug (URL) of pending posts via phpMyAdmin

I need to remove/delete slug of posts on pending via phpMyAdmin. Most of posts on pending have slug/URL which is different from their post title, deleting post slug/URL will force WP to generate new ...
0
votes
1answer
350 views

My custom sql query for getting a username giving me a warning and an error

I am writing a custom query to create a link to a specific username. A user will be logged in and can then click on a link to that user name. I am getting a warning and an error running the query in ...
0
votes
1answer
96 views

How to write in MySQL more characters in user_nicename

I install the plugin on the site for registration in Russian(Allow Cyrillic Usernames) and now I need to change in the sql database, in the table wp_users, in the column user_nicename permission to ...
0
votes
1answer
288 views

Inserting other fields to existing registration form in a WordPress theme

I wanted to add extra fields to my website's registration form but when I test it by creating a new account, the rest of the fields do not update with the registration. It was just Email, Username and ...
1
vote
1answer
113 views

WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another

I have a lot of meta_key and their relative meta_value associated to a post, for example, post_id = 4319. How can I assign, using an SQL query, all the values to another post_id? for example, post_id ...
1
vote
1answer
18 views

A MySQL DB within a MySQL DB

I have a client who does not want to switch hosting providers. This provider only allows one database per client. I am setting up a sandbox for the client and do not wish to share the database across ...
0
votes
1answer
27 views

How Fragile Is DB if I Upload Completely Updated Files

My localhost website is now just about perfect, can I just production that without worrying about Plugin and Theme updates dependent on DB?
1
vote
0answers
227 views

How do I query wp_options for expired transient pairs with MySQL commands?

I'm working on scanning the WordPress database from the MySQL CLI (so not using PHP to query) and getting results for expired or expiring transient pairs. The trick is the pairs have the same string ...
0
votes
2answers
657 views

use mysql to replace one custom field value with another custom field value

I have two custom fields, and both have numeric values: tnid_01 tnid_01old Custom Field 'tnid_01' exists for all posts. Custom Field 'tnid_01old' only exists for some posts. I am trying to ...
0
votes
2answers
546 views

Search and Replace in Windows XAMPP site

In my Ubuntu VPS, to search and replace in a DB of a site I do for example: cd /var/www/html/example.com sudo wp search-replace "http://" "https://" --all-tables Yet in Windows 10 I use XAMPP and ...
0
votes
1answer
672 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 ...
1
vote
1answer
83 views

How are multiple Wordpress WPDB queries handled?

In my code, I use this query to get all the rows where credited field is false: $uncredited_incentives_query = $wpdb->prepare( "SELECT * FROM $incentives_table WHERE user_id = %s AND credited =...
1
vote
1answer
3k views

How can i create a WooCommerce product programatically or using sql query?

I want to add a product to a cart problematically without using the admin panel. Add to cart and then checkout using php code. So how can i achieve it and where do I place the code? I am writing a ...
1
vote
1answer
338 views

MySQL crashed because of the large number of requests

I often began to fall down mysql. I recorded a large number of requests: | 243751 | user | localhost | database | Query | 985 | Sending data | SELECT option_name, option_value FROM wp_options WHERE ...
0
votes
1answer
132 views

Moving wordpress site from localhost to live server using GoDaddy cPanel

I'm using GoDaddy cPanel hosting to move my site from localhost. It's the first time I've done this and I've hit a dead end. I've followed the instructions from these instructions. I've used ...
0
votes
1answer
412 views

Delete user meta based on key value that is an array

I have a user meta key prize which is an array contains prize type and prize date. The date in unix timestamp. How I can delete the user meta by specify the prize date only? Example code: ...
1
vote
1answer
913 views

How do I find which articles are missing a featured image in The WordPress database?

How do I search the database to find out which articles are missing a featured image on them? I looked around in the wp_posts table and searched post_type is equal to article. It gives me a list of ...
0
votes
1answer
1k views

Export Yoast Keywords from MySQL/phpMyAdmin

I'd like to export all focus keywords from Yoast, as we're moving platforms to Craft CMS and using a similar tool, Ethercreative's SEO tool. I'd love a good query to pull these from the database, ...
0
votes
0answers
902 views

Wordpress doesn't create table on plugin activation

I am trying to create a table on the Wordpress database as the plugin gets activated. My code is the following: in the main plugin file: register_activation_hook( __FILE__, 'sillyplugin_install'); ...
2
votes
1answer
707 views

How to speed up wp_query, took more 5s to run against 100k posts

I used a very sinmple wp_query to retrive 10 posts on site with more then 100k posts. This query run on wp-multi site, same query against small site in same network (same db server) took very few ...
0
votes
1answer
150 views

Delete all users meta that named: user_avatar

I want a code like this: UPDATE `jnkdadb7a_usermeta` SET `meta_key`='x1' WHERE (`meta_key` = 'x2'); I want a SQL command to search inside jnkdadb7a_usermeta table for meta_key (X) and delete it.
2
votes
1answer
388 views

AJAX in Wordpress, sending coords data to MySQL and show after into map

I've spent some months trying to figure out how to get users geolocation and pass it into MySQL and so after being shown with markers on the map. I've got stuck already in passing the data through ...
0
votes
1answer
44 views

Same database; different WordPress

I have a production site 'domainA.com', which is a multi-site WordPress installation. I have another site 'domainB.com'. I want domainB.com to have exactly the same contents and configurations of ...
1
vote
2answers
2k views

How to select WooCommerce products by post_meta and order them

I'm using the following code to select products with the following post_metas: _product_new, _product_almost_new, _product_old add_action( 'woocommerce_product_query', 'custom_vtp_shop_order' ); ...
0
votes
0answers
182 views

Order Posts By Custom Field That is an array of objects

I have a custom field called "departure_dates" which is an array of objects with the keys "start_date" and "end_date". as Json, it would look like: "departure_dates": [ { "start_date": "...
0
votes
1answer
3k views

Wordpress Site Running Extremely Slow on Dedicated Server

I have a wordpress site (link here) which runs the WooCommerce and WooZone Amazon Affiliates plugins. I have been working to optimise this site and get it running as quick as possible. Unfortunately, ...
0
votes
2answers
1k views

Valid SQL query return empty

I see the following string when I print my prepared query: "SELECT p.ID, COALESCE(w.value,Display_name) value, p.post_title, p.post_date, p.post_content,p.post_author,user_login FROM wp_posts p INNER ...
0
votes
1answer
109 views

Duplicated site isn't recognized as a site

I've duplicated a site using the following code. All code worked fine until the last row (the site itself goes up on the web but the last row of code fails and I get an error): echo "Please enter the ...
0
votes
1answer
25 views

WPCLI search and replace in a particlar site dir effect another site-dir

In /var/www/html I have a site dir. I've duplicated that site's dir and db into a new site dir and db by the name of "test" (without quote marks), and changed wp-config.php accordingly. I Navigated ...
0
votes
1answer
212 views

How can I programmatically change a MySql variable (foreign_keys_check)?

I am creating custom tables from a plugin. Foreign keys are required. To be safe, I'm want turn off foreign_keys_check before issuing maybe_create_table(). This codes is what I have to check ...
0
votes
1answer
989 views

Checking for new message using AJAX and PHP. Server overload?

I wrote a script (it may not be perfect, I'm newbie) to check for new message (using ArrowChat and Buddypress) every X mins. It works good, but I'm worried will it overload my server? It's shared. ...
0
votes
2answers
742 views

How can I export posts with featured images, without download them

Exporting posts with featured images without downloading them. I work with a site that has 10000 media in a blob and nothing is allocated in the uploads folder. How do I export the posts without ...
0
votes
1answer
30 views

How can i syn wordpress user table with a stand-alone php script?

I have a wordpress membership site running with users already signed up. I currently installed a new php script on the same mysql database which will require existing user to signup. I would like the ...
0
votes
2answers
587 views

Bulk append URL (add word to slug)

Is there a way to bulk add one word at the end of each URL for posts? I have around 3500 posts and it would be time consuming to add to each one. For example URL's are www.example.com/my-post/ www....
0
votes
0answers
613 views

Query doesn't display text data with apostrophes

I've got this code: if (is_user_logged_in()) { $user = wp_get_current_user(); $tenantsInfo = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM exp_ten WHERE tenant_number = %d ", $user->...
0
votes
1answer
15 views

(Who to follow) Twitter widget

Hello I have a social network site and I want to make (Who to follow) widget like Twitter, each user I have on my site have two custom meta: following_users (users that I follow) followers_users (...
0
votes
2answers
154 views

Moved site, Old links in pages still pointing to old host

I am sure someone has answered this but I have not found a definitive answer. I have a site that I moved from one site with an old domain to a new host with an new domain. I changed the site URL in ...
1
vote
2answers
1k views

How do I transfer user passwords from one WordPress site to another?

Let me begin by saying I know this is generally advised against but I'm in a tough spot at work where this is essentially being demanded and to my understanding it's theoretically possible. I am ...
1
vote
2answers
3k views

How to get last updated row or ID in wordpress

How to get last updated row or ID in wordpress. Like : $wpdb->insert_id;
0
votes
2answers
611 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) { ...
0
votes
1answer
114 views

How does WP work in conjunction with a web server?

I have background in programming (I am an electrical engineer and have become familiar with numerous languages over the years); however, I only starting working with wordpress and backend web ...
2
votes
1answer
494 views

Slow Mysql Queries

I'm having issues with Wordpress being too slow. I discovered it's because of MySQL queries. They take sometimes 2 - 10s - way too long. I installed Query Monitor to see what's causing the problem: ...
1
vote
1answer
115 views

Which is more efficient? Using usermeta, or creating a new MySQL table?

I'm building a bookmarking feature, allowing users to place a marker inside a blog post. The data will then be saved in the database, and retrieved upon opening that blog post. The same concept can ...
0
votes
1answer
2k views

Submitting a form, using Ajax, to run a SQL Select query based on user input from the form

I'm creating a web form on my WordPress-powered website, such that by entering a date and some upper/lower bounds into the provided fields, then submitting the form, the page will query a MySQL table, ...
0
votes
0answers
437 views

An SQL query to find orphaned image attachments and their meta

This is for people who are good with MySQL queries. I'm using phpMyAdmin locally to try to optimize an old WordPress & Woocommerce site which has gone through a couple of iterations over the years....
0
votes
0answers
145 views

Multiple wpostmeta.meta_key

i need to add a new condition to this query: $querystr = " SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE post_id IN( SELECT DISTINCT wpostmeta.post_id ...

1
6 7
8
9 10
28