Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mysql]

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

0
votes
1answer
19 views

Custom route and query

I am trying to use a custom WordPress route and function, but I am getting a route and function not found error. Below is my code but I am not sure where it is breaking: add_action('rest_api_init', ...
0
votes
0answers
14 views

Installing MySql 8 for WordPress dev machine, what is the correct table name sensitivity option?

Context When installing MySql 8, the installer asks for if the table names are all lowercase or preserve case. Question What is the correct setting in case I would like to run WP 5 on that MySql ...
0
votes
1answer
18 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 ...
0
votes
0answers
33 views

Order by summing multiple values

In a custom post type (products) I want to order products by summing multiple values based on user selection. I use custom taxonomies to filter the products. I could use the orderby meta_value but ...
0
votes
0answers
12 views

ERROR Converting MyISAM to InnoDB

I have an issue with converting some tables from MyISAM to InnoDB with phpMyAdmin I get this error when using ALTER TABLE wp_posts ENGINE=InnoDB; . Error SQL query: ALTER TABLE wp_posts ENGINE = ...
0
votes
1answer
17 views

WordPress Database Query works in phpMyAdmin but not in the code

I have a simple SQL query: SELECT * FROM test_table__csv_import_temp_joblist WHERE url ='https://www.example.com' In phpMyAdmin, it works well and returns a result. In WP it returns nothing: $sql ...
0
votes
0answers
19 views

HA WordPress implementation question

I am looking forward to eliminate SPOF in my PHP/Nginx/MariaDB/Redis WordPress website. For this purpose, I am about to move from a single server to a more complex HA scenario that as far as I ...
0
votes
0answers
23 views

Issue developing an AJAX form with Wordpress

I am trying to develop a custom form working with AJAX. But there is no way to work because everytime it gives me the below message: "POST http://wellness4yourself-com.stackstaging.com/wp-admin/...
0
votes
0answers
18 views

update_option returns false in AJAX, how to debug?

I tried debug plugins for WordPress, but they only show the current page SQL queries. How to debug if update_option returns false? I am updating an object decoded from AJAX request with json_decode ...
0
votes
0answers
12 views

Issue Converting Get_Results to Prepare to add a variable

Afternoon all. I'm trying to convert the following get_results query to allow the use of a variable dependent on which page link will be clicked for a team roster page. I currently have 3 different ...
0
votes
2answers
20 views

WP + MySql db / PHP

I have a website running WP connected to a MySql db, where the latter uses PHP. I did not make the site and have only small experience with WP. This may be a simple question. The WP also uses ...
0
votes
0answers
13 views

Why can't i come back to older working version of php after ugrade with error log on php 7.2 and 7.3

I'm getting locked out of */wp-admin/ there is an error log. Its after changing php 7.2 to php 7.3. The error doesn't disappear even if i go back to php 5.6 where MySQL_connect function exists and is ...
-2
votes
1answer
15 views

why you don't Implement PDO for access every thing to database

that is.. why wordpress don´t use PDO if it is more secure, and prevent a lot of injections, and issues with security. Thakns
1
vote
0answers
20 views

how to solve slow WordPress site caused by attachment_metadata

My WordPress sites starting to become slower by time, after two years they become very slow. I tried many things, such as: improved my DB, used cache plugins (WP Rocket and W3 Total Cache) which both ...
0
votes
1answer
15 views

How to insert data into MySQL database from the form created in WordPress site

How can I insert the data entered into the form in WordPress site to the MySQL database? I have created a form in the site. I am able to run PHP codes using snippets but I don't know how to update the ...
0
votes
1answer
24 views

Ajax $wpdb not returning table data

I'm using WordPress 5.0.2 with WooCommerce 3.5.3 and I have two selects dropdown field on the checkoutpage. I want to retrieve the selected region_code value from the billing_region dropdown and then ...
0
votes
1answer
30 views

Update MySQL query so that it functions again

I've inherited an old WordPress site that my customer doesn't want to be rebuilt. It has an old MySQL query in the functions.php of the theme that is supposed to put a category image with the ...
2
votes
2answers
105 views

How to create 450 categories in wp

I am having trouble to find a way for how to add categories for all the products. I have Apple, Samsung, Sony, Xiaomi, Huawei categories and each of there needs subcategories which will stand for ...
2
votes
0answers
26 views

Keeping database within limits, please help!

I have a website that auto generates odds data to mysql table via cron job every 2hrs. Over time the data in my table is exceeding the limit set from my hosting of 100mb. I want to stop my table from ...
0
votes
0answers
17 views

Php find date in meta_value between 2 date ranges

I want to search SQL database using PHP and look for meta_value. The meta_value contains data like this: "FixtureMatch_Id":"391270","Bookmaker":"1Bet","UpdatedDate":"2018-12-14T12:48:57.64"" So ...
1
vote
1answer
32 views

Changing user_nicename

user_nicename has the same value with user_login. I want to change user_nicename value only by using code snippet into functions.php or wp-config.php. Is it possible without using phpmyadmin or any ...
0
votes
1answer
18 views

Sql Update CPT from publish to draft and particular custom field

I have: CPT: match custom field: played Is it possible by MySql to change the status from publish to draft of all posts of CPT 'match' with custom field set as '0'? A good start can be UPDATE ...
-1
votes
1answer
18 views

Add a navigation menu item using MySQL

I want to insert Wordpress nav menu items into MySQL using PHP. I dont think i can use wp_create_nav_menu() because I need to build a preliminary menu from the categories (over 100 cats!) then a ...
0
votes
1answer
49 views

how to encyrpt DB_PASSWORD in wp-config

Recently moved my wordpress site to another hosting provider and after importing my database I had issues establishing a database connection. I edited wp-config file and entered my DB_PASSWORD to re-...
0
votes
2answers
38 views

$wpdb->prepare with LIKE and sprintf

Ok, I know similar questions have been asked before but none of the answers I found seem to work. Here's my code: $sql = $wpdb->prepare('SELECT ID FROM ' . $ignore_url_table_name . " where url ...
1
vote
1answer
32 views

How to handle 400 status in Ajax [duplicate]

I have created a page in wordpress which is hosted in localhost. The page containing two drop down lists. one is for selecting category lists from a table called 'category' and the second drop down ...
0
votes
2answers
37 views

AJAX Implementation

Am try to implement data from database using AJAX based on a drop down list in WordPress. The codes returning 400 bad request in the console. I am hosted the page as localhost. Here is my theme's ...
0
votes
2answers
17 views

How to configure Wordpress Database for CentOS 7

I'm trying move an existing Wordpress site to run across two different servers, one with Apache and the main source code and the other that just has the database running on MYSQL. wp-config: define('...
0
votes
1answer
109 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 ...
0
votes
1answer
57 views

How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option

I'm having troubles with the mysqli driver used by wordpress, where it is converting each and every integer value to a string within $wpdb->get_results("SELECT..."). I know that it is possible so ...
0
votes
2answers
37 views

Case insensitive ORDERBY in wpquery

I'm trying to sort custom posts in alphabetical order, and I've just now realized that capital letters are being sorted before lowercase. Two restaurants start with 'Cal' and 'CAT' with 'CAT' being ...
0
votes
1answer
28 views

Search returns “Nothing Found” on a sub directory

I've created a multisite using subdirectories. The search function, both in backend and frontend, only works on the main site. If I try and do a search in a subdirectory it returns with "Nothing Found"...
0
votes
1answer
62 views

Delete posts with word count less than x number of words

I searched a lot about this, found plugins that are out dated and consumes massive resources and finally do nothing, is there like an SQL line to delete all posts that have a word count like less than ...
1
vote
0answers
22 views

How to delete posts that does not have a thumbnail?

I have a problem with my blog. The thing is this, all the posts have a thumbnail in this address: wpbv_postmeta-->meta_key-->thumb And several (A LOT) of posts don't work, because I have made a ...
0
votes
1answer
29 views

The plugin generated 225 characters of unexpected output during activation

I am getting the famous "The plugin generated xxx characters of unexpected output during activation." error when I activate plugin I am working on. Terminal says my files are in us-ascii, but when I ...
0
votes
1answer
57 views

Update a user meta key based on WooCommerce product purchase

I have a WooCommerce shop. I have a custom user meta key for user expiration that I need to update based on the result of all users who have purchased a specific product. Unfortunately, I have not ...
0
votes
0answers
37 views

Get menu items in MySql Wordpress database via sql query

There is menu 'menu-name' on wordpress site. On wordpress I can get menu by $menu_items = wp_get_nav_menu_items( 'my-menu' ). Then in foreach loop I get url for menu item: $url = $menu_item -> url. ...
0
votes
0answers
15 views

AJAX request returns back Array0 to console

I'm making an AJAX request in wordpress for the first time and I'm trying to access my custom made table to retrieve single name (string) or multiple names. It all works without the errors, except for ...
0
votes
0answers
8 views

sql query for selecting btween two amounts

I am trying to achieve result by selecting dropdown between two amount range. echo '<option value="browse-events?city='.$browse_city.'&type='.$browse_type.'&price=Free">Free</option&...
2
votes
0answers
50 views

Find duplicate posts with same slug and author

We imported over 250K posts into our multi-author WordPress database but have found duplicate posts where the same author has multiple posts with the same slug. Could you please recommend a MySQL ...
1
vote
1answer
88 views

How to get data from WordPress site sql file

I have an SQL file of my WordPress site but I lost my project files. So if I import the sql into my DB then can I run the sql with new database file? Or is there any other way to back the previous ...
0
votes
0answers
14 views

Search Plugin expects different date format in DB - workaround?

I have two plugins: Events Manager and Search & Filter First one stores dates as YYYY-MM-DD in database, second expects YYYYMMDD format. What would be an easy workaround to get this working? ...
0
votes
1answer
32 views

Unexpected behavior when trying to manually install Wordpress on macOS Sierra

Server Configuration macOS Sierra 10.12.6 Server App v5.3.1 (Websites Service is ON and serving other sites) mySQL v8.0.12 (Verified up and running) PHP v7.2.10 (Verified through phpinfo()) Wordpress ...
-1
votes
0answers
12 views

Wordpress Plugin (Want to create table but also insert some data into custom database?)

I'm working on creating a plugin, my first, but I'm wanting to create a few tables, but one in particular I would like to add some information too in order to pre-load on the plugin install. I can't ...
0
votes
1answer
32 views

DB Query not working in Plugin

I am working on a plugin. And I want to create a table via the plugin. So I am trying execute following SQL Query. global $wpdb; $createSQL = " CREATE TABLE `". $wpdb->prefix ."...
0
votes
0answers
29 views

How to automate WordPress database migration?

So I have several WordPress sites that I do work on locally, and then migrate changes to a test.sitename.com (to check for issues), then to sitename.com. I want to write automation script myself, I ...
0
votes
0answers
12 views

How to map data on CSV to web pages?

Like Contact information, descriptions, budget, prices, other numbers, on a CSV or spreadsheet, how to link it to WordPress web page? I'm using cpanel, WordPress, Tablepress plugin, elementor page ...
0
votes
1answer
110 views

How to unserialize data from MySQL

I'm trying to unserialize data from WP's MySQL table. It looks like this my function from template-page.php <?php function get_values(){ global $wpdb; $parsed = $wpdb->...
0
votes
0answers
8 views

Multisite Search by custom taxonomy

With multisite, each blog has its own table. I want to create a plugin that will add custom taxonomies to all blogs. I know how to do this. Then I want to create a query to return all posts for a ...
0
votes
0answers
31 views

Why does the correct MySQL “UNIQUE Key” syntax not work in the dbDelta function?

this is the working Mysql code CREATE TABLE customtable ( id mediumint(9) NOT NULL AUTO_INCREMENT, email text NOT NULL, emailverifytoken text NOT NULL, UNIQUE Key (email(255)), UNIQUE Key (...