Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
2
votes
0answers
36 views

Get the Plugin Which Triggered a MySql Query in Wordpress?

I am currently working on this plugin, which is similar to Query Monitor in which i Have displayed all the Details present in the $wpdb object. Now i need to find which plugin is Triggering the Query. ...
1
vote
0answers
99 views

306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]

I realized that my wp_options table is huge, hitting 473.2 MB, which made me curious. Then I started to run a few queries until noticing that the following query returns 306378195 bytes, or ~306 MB. ...
1
vote
1answer
488 views

Delete all post meta except featured image Using SQL

Please I just migrated my site and I found out that wp_postmeta consumes most of my cpu resources, Is the any Sql code to Delete all post meta except the featured image. I dont want to Use wp ...
1
vote
0answers
97 views

Wordpress plugin creation how to execute .sql in order to insert multiple rows at activation of plugin

I am creating a wordpress plugin which upon activation i create my database table. I have an .sql file which has ~2000 rows of data and i would like to execute it after the creation of my database ...
2
votes
1answer
3k views

Error: MySQL shutdown unexpectedly. XAMPP local conf running WordPress

I have a xampp configurated locally to run wordpress. I must have done something wrong when fixing some issues 'cuz at the end, I got stuck with the following log from mysql database. 2015-11-10 15:...
2
votes
1answer
212 views

Is the regular ajax request method safe or I should use admin-ajax.php?

On the homepage I have some links: <a class="link" data-id="1">first link</a> <a class="link" data-id="2">second link</a> <a class=&...
1
vote
1answer
198 views

Modify MySQL Query Based on Dropdown Menu

I would like to be able to modify a MySQL query based on the selection in a dropdown menu. This would then update the subsequent table shown on the page. The current code I have is below (note I'm ...
0
votes
1answer
564 views

Ideas how to search & replace post_content when string contains a newline?

I've previously been able to search & replace using the very helpful "Search & Replace" plugin for wordpress but now i've came across a problem i cannot solve. In table wp_posts i want to ...
0
votes
1answer
881 views

SQL query to set posts in bulk based on the post content

I have thousands of offline links in my posts, and I'd like to set them all to draft. I know the links are in the format example.com/fileX. So I needed a SQL query to search the post content and ...
0
votes
0answers
53 views

Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies

I have 4 custom taxonomies that are associated with a custom post type "procedure": "vehicle_year", "make", "model", "axel_type". I've built a dropdown that is dynamically populated based on the ...
2
votes
1answer
674 views

Get terms of posts with category with sql

I have a taxonomy of type and a taxonomy of category. How can I return a list of every type term of posts in a single category? I know I can do this: // Final array of all types: $...
0
votes
1answer
5k views

Delete post results in “Cannot delete or update a parent row: a foreign key constraint fails”

I am using wordpress 4.9.6 with mysqlnd 5.0.12-dev as db. I have created my own tables which uses post_id as a Foreign Key Constraint. When I want to delete a post in my backend I get: WordPress ...
1
vote
1answer
181 views

WordPress database error for query INSERT INTO

I am trying to insert data into a custom table. I am using a mysql db with phpmyadmin in my backend. However, I get the following error: [28-Jun-2018 19:36:05 UTC] WordPress database error for query ...
1
vote
1answer
78 views

How to get related tags based on a category?

To better explain my question, there is an example: I have 3 posts, all of them have category "Tech". Post A is tagged with "Google". Post B is tagged with "Facebook". Post C is tagged with "Google"....
0
votes
0answers
1k views

WAMP SERVER Command Prompt SET PATH=%PATH%

My WAMP SERVER will not connect to website in wamp server after I went to command prompt and typed in PATH=%PATH% is there any way to revert this??? I'm an idiot I admit it.
1
vote
1answer
411 views

How to add and SQL query of posts only published

I have a notification on a menu item and need to change the number on the notification. I'm missing an argument of show only "Published" posts. Right now it's pulling in everything in draft too. Here'...
0
votes
0answers
245 views

Insert data from form to database

Hello people on this forum! I have a question, I need to insert some data from a form that I created to the database , I have tried this code: if (isset($_POST['submit'])) { global $wpdb; ...
0
votes
0answers
68 views

Mysql query - amount spent by customer

I am trying to write a query to pull amount of money spent by each customer. I have not been able to find anything searching the site. Thanks in advance!
0
votes
0answers
16 views

append data to mysql table via submit button coded in php - not working

I have a form in the woocommerce account side which should append new entries to a custom table I have added. However, I cannot figure out WHY when I press the submit button ... nothing happens. What ...
1
vote
1answer
1k views

Sum the total amount of a specific product purchased per user and display in table

I asked this in Stackoverflow but figured this would be a more specific domain to answer my question... I have a large mysql table (in woocommerce) where people can purchase items more than once. My ...
0
votes
1answer
402 views

How to create index (sql) to a meta_key?

I am new in programming, and the sql is absolutely stranger for me. I create today a new meta_key on my multisite, but when I use this in a query, my site will be horrible slow... I read (here: https:/...
1
vote
0answers
14 views

Ordering users by custom user meta

I have a list of users, and I would like to select a few to appear at the beginning of the "faculty" page, and then display the rest afterward in alphabetical order. With the following code (...
0
votes
1answer
487 views

Add value to usermeta without removing previous values?

How do I add a value to the key dismissed_wp_pointers without removing the existing values (if there are any). Doing this will put the value there, but it will remove everything existing first. ...
1
vote
3answers
1k views

How to execute mulitple statement SQL queries using $wpdb->query?

I call $wpdb->query() on a query like INSERT INTO wp_ctt_timetables (name, homework, tod, class, dow, lesson) VALUES ('', '', '', 3, 0, 0); INSERT INTO wp_ctt_timetables (name, homework, tod, ...
1
vote
1answer
416 views

Remove one value in dismissed_wp_pointers?

I use admin pointers to show a "tour" of the dashboard. And when the user has taken the tour and pressed the Close button, it saves a value in 'dismissed_wp_pointers' under the specific user in '...
1
vote
1answer
246 views

Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working

So interestingly, I moved my main plugin file into a folder within the plugin directory. Where before the register_activation_hook worked perfectly well, it now does not work; however, the ...
1
vote
1answer
2k views

How to add 2 hours to the wordpress time formed with current_time(“mysql”, false)?

How to add 2 hours to the wordpress time which has already been formed using current_time("mysql", false)?
1
vote
1answer
176 views

How to connect to AWS RDS external database (not for the core WordPress db)

I'm trying to connect to an external database on AWS RDS to display data from the external database in WordPress, using a plugin I'm writing. My only issue is connecting to the external database and ...
2
votes
0answers
220 views

Emojis getting converted to “?”

Emojis in posts and comments on a 500+ posts blog get converted automatically into single question marks in irregular and untraceable intervals. The respective tables wp_comments and wp_posts are ...
0
votes
0answers
26 views

New database entry to trigger runing PHP/SQL query through link with token, without logging into the website

I want to do particular verification process for my wordpress users, and I want to know if it is even possible, before I spend any more time trying. This is what I have in my WordPress so far. My ...
0
votes
1answer
29 views

next comment id number wordpress

I have removed many spam comments from my very old blog (over 3500 spam comments) and purged from the database. Last comment ID was 3620 after removal latest comment has ID 853. New added comment ...
0
votes
1answer
621 views

Pull MySQL data from multiple tables and merge into 1 PHP array

Appreciate help in advance. I am dealing with a bit of a pickle with a formula. I am trying to create a page template that will display a list of users, specific metadata from usermeta table + ...
0
votes
2answers
66 views

'posts' table should not store the absolute image path

I'm having some difficulty in making a sandbox from a website, and one of them is that wordpress is registering the absolute path of the image in posts.guid field: http://example.com/path/image.jpg ...
0
votes
1answer
169 views

Deleting a table row through query

At this moment i am trying to modify this plugin that deletes table rows to delete ONLY rows that don't contain the word "Cekanje" in the column "Status", this is the code and the solution i am trying ...
0
votes
1answer
1k views

Query Column of Specific ID from Database Table

I am trying to display a particular value from the WordPress database for a specific ID with no such luck. I am not receiving any errors, but just an empty result. Here is my table: table name: ...
0
votes
1answer
130 views

OR condition not working

I am using the following code to search some data from WordPress database, but when first condition is false then OR condition is not working. $where .= ' AND ((' . $wpdb->posts . '.post_title ...
0
votes
1answer
200 views

Query postmeta based on meta_value, return array of post_id

I'm trying to retrieve an array of post_id from postmeta where the meta_value matches some value. In MySQL the query would be something like this: SELECT post_id FROM azEw_postmeta WHERE meta_key='...
0
votes
1answer
15 views

Dev and prod on the same database- dev version active for IOS

I'm looking at a problem on a WordPress site I didn't build and the company that did are no longer operating. The site is fairly basic with no user membership this etc etc. The site holds all its ...
0
votes
0answers
83 views

Use the loop to check if DB record exists?

I have a somewhat unorthodox (i guess) question. I have a function that adds a records to my MYSQL DB, with location lat and lng info. However sometimes that function is not working correctly, causing ...
0
votes
1answer
32 views

Change default login auth

I am going to enhance my WordPress authentication page. My idea is simply, is just change the process to check password, like the default process login with username or email. I've change the ...
0
votes
0answers
909 views

403 Forbidden home on localhost with nginx server

I install wordpress in nginx server on my localhost using debian OS, install is normally. But I only can login to my dashboard using localhost/statistik/wp-admin/index.php not in localhost/statistik/...
0
votes
1answer
322 views

Can't Query Custom Table Using $wpdb Method

I created a custom table for my Wordpress site using Sequel Pro. I am then trying to query the table from Wordpress PHP file using $wpdb method. While I am able to run a successful query using the ...
0
votes
1answer
187 views

Copy usermeta value where ID matches in the same table

I would like to copy the meta_value from row to another (in the same table) where the user_id matches. Each user in the wp_usermeta table has a meta_key/meta_value pair for first_name and a meta_key/...
0
votes
2answers
49 views

string literals in query

I am trying to hack together something in mySQL to allow me to change from one plugin to another without having to do manual data entry for all of my products on my woocommerce store. The goal is to ...
0
votes
1answer
34 views

Trouble migrating custom post types from non-wordpress cms

I am working on migrating over some custom post types from a non-wordpress cms that we will call "shows." I am using a script in functions.php to try and accomplish this, but I am having trouble. I ...
0
votes
2answers
38 views

Making a query to the DB using same parameters of loop

So, I have a loop that works great. But I need to count how many posts that loop has, and I need to do it via a query to the DB. My loop looks like: $adsArg = array( 'offset' => $...
0
votes
1answer
418 views

SQL query : Select a thumbnail for a media

I'm doing a custom gallery for a portfolio page in a website and It works well if I simply use the URL of the media uploaded this way : SELECT * FROM wp_posts AS p INNER JOIN wp_postmeta AS m ON p....
1
vote
1answer
405 views

Enabling WP_USE_EXT_MYSQL to support old plugin

We recently did a major WordPress site upgrade (3.7.25 to 4.9.4 - yes, probably shouldn't have waited this long). I set up a test environment first and thought there would be no issues. However, upon ...
0
votes
1answer
254 views

Queries take 120+ seconds on my large Wordpress site

i have a couple of Wordpress website running on a VPS, each one of them has 1M+ posts. When adding new posts queries just hangs for a long time until the website crashes. I use XML-RPC to post to my ...
1
vote
3answers
10k views

How to force update all posts after import

I recently imported large number of custom posts into wordpress. all works fine, except one taxonomy which is imported, but not show at the front end, until i click on every post "update" button. I ...

1
5 6
7
8 9
29