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

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

0
votes
1answer
25 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
15 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
26 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
0answers
14 views

Displaying data in a table from a mysql database

I'd like to import data from the standard wordpress mysql database and display it in a table on my wordpress page. So far I did not find a plugin that elegantly does that. Please help me how I could ...
0
votes
1answer
8 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
9 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
10 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&...
0
votes
0answers
16 views

localhost laravel valet Error establishing a database connection [closed]

I'm trying to set up Laravel Valet. I've followed all the instructions: https://laravel.com/docs/5.7/valet I'm able to serve files and I'm using the WordPress instal. After I put in the database ...
2
votes
0answers
28 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
18 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
13 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
31 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
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
30 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
10 views

How to echo results of database query? [migrated]

I have written some code to access my database and echo the results onto the webpage. Unfortuantely, I must have something wrong in my code. Thank you so much for any assistance. $conn = new mysqli("...
0
votes
0answers
26 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
11 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
29 views

Some pages redirect to LAN ip

I am trying to make my wordpress installation work behind a nginx reverse proxy. I have tried it with and without ssl, I do not know where to go next. Without the reverse proxy, only from LAN, ...
0
votes
1answer
28 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
5 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
8 views

help in changing a query to retrieve random limited rows

I'd like to change this query in my WordPress plugin so that it retrieves 30 random rows out of 100. $query = $wpdb->prepare( " SELECT p.*, qq.quiz_id, qq.question_order AS `order`...
0
votes
0answers
23 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 (...
0
votes
2answers
30 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
24 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
21 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
42 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
17 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
0answers
47 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 ...
0
votes
0answers
52 views

Ajax duplicate multiple inline data checking from database

I am trying to make a form with multiple same type field (i.e. title) in Wordpress. In that case I need to ensure that no duplicate data is being attempted to insert before the form is submitted. I ...
2
votes
0answers
28 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
18 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 ...
0
votes
0answers
25 views

Create WordPress shortcode from database entries

So I want to create a shortcode for every row in my database. The problem here is that the add_shortcode() requires a shortcode, which I can create a variable for in a foreach loop and a callback ...
0
votes
0answers
15 views

MAMP Mac to Windows

I want to transfer my all of ( wordpress ) sites from MAMP server to Window ( probably WAMP/XAMPP ). How can I do that. I have copied all the sites from old server to new server ( web server's root ...
-1
votes
1answer
32 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
48 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
23 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
14 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
47 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/...
2
votes
2answers
97 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
39 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
183 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
14 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
30 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
27 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
54 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
40 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 ...
1
vote
0answers
86 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
128 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
37 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 ...