Questions tagged [mysql]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
992 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
167 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
475 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
156 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
34 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
447 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
301 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
130 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
49 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
153 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
25 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
143 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
240 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
353 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
21 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
11 views

sql query for selecting btween two amounts

I am trying to achieve the result by selecting dropdown between two amount range. echo '<option value="browse-events?city='.$browse_city.'&type='.$browse_type.'&price=Free">Free</...
2
votes
0answers
223 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
725 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
1answer
34 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 ...
0
votes
1answer
62 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
28 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
997 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
2answers
55 views

Wordpress post insertion from PHP file

I have a website it's contains a lot of news, i have to list this news in one PHP file , now i want to insert each news in wordPress as a Post.. what is the best practice way to do that (the news are ...
0
votes
1answer
38 views

Proper way to display latest 5 posts grouped by post type?

i need to display the latest 5 posts of each post type, something like: Latest BMW Posts: Post title BMW 1 Post title BMW 2 Latest Audi Posts: Post title Audi 1 Post title Audi 2 And so on. It ...
0
votes
1answer
24 views

Add postmeta to all blog posts

I have a bunch of blog posts that I need to update with a custom postmeta key/value pair. Therefore I have two questions - where can I find the postmeta entries in a worpdress MySQL database and how ...
1
vote
1answer
327 views

Is XAMPP faster than running LAMP in WSL on Windows 10? [closed]

I've been using Local by Flywheel for my local dev environment but recently it started acting weird so I decided, that since I'd finally learned a decent amount of CLI, maybe I should try just using ...
0
votes
1answer
20 views

Show Mysql table elements as pages in Wordpress

I am trying to build a WordPress site, but I need a specific functionality and I haven't been able to find a plugin for it. I'm going to be scraping sites info and posting the info into a DB (this is ...
0
votes
1answer
447 views

How to properly check if a table exists in WordPress Database using Show Tables Query

This query when runs always create logs for Database error. It works fine when table exists, but when it does not it generates the below shown debug logs. Any alternative way to check if database ...
2
votes
0answers
127 views

$wpdb->get_results() does not fetch results with unicode 'WHERE' clause

I've just a simple query to fetch a students records by his name, written in Bengali. $student_rcrd = $wpdb->get_results("SELECT * FROM student WHERE name='আবুল কালাম আজাদ'"); Although my database ...
0
votes
1answer
24 views

How To Upload Existing WordPress Site To WordPress Multisite Using SSH

I have a WordPress site that needs to move into a WordPress Multisite. I tried to find the site file to upload in wp-content/uploads/sites but I couldn't locate the file. I also tried to upload the ...
-1
votes
1answer
181 views

Query Concatenation

I can't figure out how to properly concatenate my PHP variables in my MySQL query. $convert_class_id and $convert_char_id are holding numerical values. When I try to activate my plugin I get an ...
0
votes
1answer
196 views

How to use mysql LIKE with wpdb?

as per title I need to use LIKE operator to delete a row on db programmatically with $wpdb. I wanna use $wpdb->delete to remove an occurrency but I don't know how to set the LIKE operator because ...
-1
votes
1answer
27 views

Get all the related data from WordPress DB

I have 2 custom tables inside the DB WordPress is installed in, With one-to-many relation between both tables. Here are the two tables: posts table ...
1
vote
0answers
18 views

Update results, Before deleting the related category [closed]

There is a DB that contains 2 tables posts and categories, Each category could contain many posts, So I'm using one-to-many relation between the two tables. Using the id of the categories and a ...
1
vote
1answer
95 views

Converting MYSQL to WordPress $WPDB

I’m upgrading an archaic Wordpress site from 3.7. It has some SQL query requests that don’t function after 3.9+ where you now have to connect to the DB via $WPDB (https://codex.wordpress.org/...
3
votes
2answers
422 views

How to make WordPress plugin check for database changes and then do something?

How do I for instance check if there is written a new comment in the database and then make my plugin register that there have been a change? I will use this information to do something in the ...
0
votes
0answers
46 views

How can I verify WordPress nonce from the following code?

<?php /** * Template Name: Manage Days */ if ( isset($_GET['remove_date']) && isset($_GET['_wpnonce']) ) { $delete_date = $_GET['remove_date']; $delete_nonce = $_GET['_wpnonce']; ...
1
vote
2answers
2k views

How to get posts on a specific date - WP Query

I want to get posts of a specific date, I tried the following code but I did not get the result what I wanted. <?php $mil = 1532996880000; $seconds = $mil / 1000; $dt = date( "Y-m-d", $seconds ); ...
1
vote
0answers
16 views

Randomised Post Time

I've imported a Drupal site to Wordpress with an archive of 1000s of posts which had been backdated by adding a custom taxonomy 'Year' rather than by adjusting the post date. I've been able to remove ...
2
votes
0answers
34 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
65 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
338 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
63 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
0answers
411 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
143 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="link" data-id="3">third link</a>...
1
vote
1answer
94 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
270 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
471 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
46 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
381 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: $...